Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Connect to Selenium service from within docker container

In Pipelines I can install a Drupal site successfully and from within its container I can access it at http://localhost:80. I am executing Behat tests and non-@javascript scenarios are working (via goutte) but @javascript scenarios are failing (via selenium2). I get the following error when running a @javascript scenario:

unknown error: net::ERR_CONNECTION_REFUSED
  (Session info: chrome=89.0.4389.82)
  (Driver info: chromedriver=89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389@{#294}),platform=Linux 5.4.92-flatcar x86_64) (WebDriver\Exception\UnknownError)

I'm wondering if it's possible to connect to the Selenium service from within the container?

In a build step, I run:

docker exec -i app bash -c "echo \"$BITBUCKET_DOCKER_HOST_INTERNAL host.docker.internal\" >> /etc/hosts"

This allows me to access the mysql service at host.docker.internal:3306 from within the container.

I assume the same should work for the Selenium service, making it accessible at host.docker.internal:4444 from within the container but the error above is output.

Here is part of my bitbucket-pipelines.yml file to help provide some more context:

pipelines:
  default:
    - step:
        script:
          - docker build -t my-ci .
          - docker run -dit --name app -p 8080:80 my-ci
          - sleep 5
          - docker ps
          - docker exec -i app bash -c "echo \"$BITBUCKET_DOCKER_HOST_INTERNAL host.docker.internal\" >> /etc/hosts && /var/www/vendor/drush/drush/drush si --db-url=mysql://drupal:drupal@host.docker.internal:3306/drupal -vvv"
          - docker exec -i app bash -c "curl http://localhost:80/user/login"
          - docker exec -i app bash -c "cd /var/www/tests/behat && composer install && bin/behat"
        services:
          - docker
          - mysql
          - google-chrome

definitions:
  services:
    mysql:
      image: mysql:5.7
      environment:
        MYSQL_DATABASE: 'drupal'
        MYSQL_USER: 'drupal'
        MYSQL_ROOT_PASSWORD: 'root'
        MYSQL_PASSWORD: 'drupal'
    google-chrome:
      image: selenium/standalone-chrome

1 answer

1 accepted

0 votes
Answer accepted

After a lot of trial and error I realized the mapping of 8080:80 was causing issues. Instead I mapped 80:80 and I can now successfully run my Behat @javascript tests.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Staying organized with Jira: best practices for a better project management

Project managers know this problem: A “mountain of work” lays in front of you, and you don’t know how and where to tackle them. Different to-dos lie ahead, but just one task after the other can be ha...

129 views 1 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you