Installing Chrome inside of your Docker Container


Update: this information is superceded - see post from Tom below.

We’ve had quite a few people have issues getting chrome to work properly inside of their custom Docker image. I finally got a definitive way to get this to work each time.


Please add the following to your Dockerfile in order to install chrome

# Install Chrome
RUN wget
RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install

If you don’t want to run a custom image, but are using a base image that does not include chrome (assuming the base image is based on ubuntu or debian) you can also install it as a part of your build by adding the following to your circle.yml

type: shell
command: |
  dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install

Running Chrome

In order to run chrome, you need to start Xvfb (and of course it must be installed in your base image)

Export the display in your ENV section, and then start up Xvfb in the background before your browser tests start.

version: 2
executorType: docker
    - image: ubuntu:14.04
        - DISPLAY=:99
        - CHROME_BIN=/usr/bin/google-chrome

- type: shell
  name: Starting Xvfb (for Browser Tests)
  command: Xvfb :99 -screen 0 1280x1024x24
   background: true

Karma jasmine tests under 2.0
Running browser tests

you can use a docker image that contains the selenium and chrome or ff to run the browsers tests

selenium/standalone-chrome: Selenium standalone with Chrome installed

selenium/hub: Image for running a Selenium Grid Hub selenium/node-chrome: Selenium node with Chrome installed, needs to be connected to a Selenium Grid Hub selenium/node-firefox: Selenium node with Firefox installed, needs to be connected to a Selenium Grid Hub


Thanks @cpanato that’s a great way to do this on CircleCI 2.0

For others seeing this:

In CircleCI 2.0 you can use selenium/standalone images.

Simply add the following to config.yml:

  - image: selenium/standalone-chrome:3.1.0

Current versions for Firefox and Chrome:

Your tests should now run just as they do locally if you’re set up for webdriver / selenium etc.

Selenium in docker image

If you find that you need Chrome or Firefox, note that we now provide convenience images with browsers pre-installed. Look for the node-browsers variant of our images, such as circleci/ruby:2.3.3-node-browsers.