Connecting to selenium/standalone-chrome



I’m having a problem connecting from my host container to selenium/standalone-chrome (and perhaps back).

Important details:

  • Capybara server is run on the host container at
  • Test code determines the host’s advertised IP address e.g.
  • Capybara Instructions execute on selenium/standalone-chrome container via api call to and gives it urls such as to visit the server on the host container.
  • This works on an OSX host with manually running the selenium container with docker run -p 4444:4444 selenium/standalone-chrome:3.0.1-germanium

Interaction (host ip

  1. host api call to selenium ->
  2. selenium browser visit ->


This abbreviated snippet shows the relevant parts:

version: 2
executorType: docker
  - image: alienfast/ruby:1.0.3
      - RAILS_ENV=test
  - image: selenium/standalone-chrome:3.0.1-germanium
    working_directory: /root/af
      - checkout

      - run:
          name: Run tests
          command: |
            mkdir -p test-reports/cucumber
            bundle exec rake "knapsack_pro:cucumber[--format junit --out test-reports/cucumber/junit.xml]"

I had tried to manually run the image like I do locally but that didn’t work and seemed unnecessary, so I changed to run the same as I do mysql and bound to the host container, but experience the same error.


What am I missing?

  1. Should capybara test code be able to connect to selenium on with this configuration?
  2. Should the selenium container be able to connect to the host container at <host_ip>:4100?
  3. How can I debug this on the server - does add-ssh-keys allow me to login to 2.0?


I seem to have broken through.

I think the key may have been that I added EXPOSE 4100 to the primary image. I am not currently successfully testing, but I have connected and am receiving a javascript error from selenium, so that is progress.


@rosskevin I have the same issue, can not connect to ChromeDriver, have the errors like:

             Unable to find chromedriver. Please download the server from and place it somewhere on your PATH. More info at

can you tell me how to expose the port 4100 within circleci config file?


I’m not sure how to EXPOSE 4100 within circle ci config, I’m guessing you can only do this by customizing your container image. Circle ci support should be able to tell you.


Here is my configuration:

# .circleci/config.yml
version: 2
      - image: circleci/ruby:2.4.1-node
          RAILS_ENV: test
          SELENIUM_DRIVER_URL: http://localhost:4444/wd/hub
      - image: circleci/postgres:9.6.3-alpine
      - image: selenium/standalone-chrome:3.4.0
    # ...

And configuration for Capybara:

require 'capybara/rails'
require 'capybara/rspec'

Capybara.register_driver :selenium do |app|
  if ENV['SELENIUM_DRIVER_URL'].present?
      browser: :remote,
      url: ENV.fetch('SELENIUM_DRIVER_URL'),
      desired_capabilities: :chrome
  else, browser: :chrome)

I hope this was helpful.


closed #6