As an engineer, I want to test my web app with Chrome in a Jenkins cluster. Chrome is not available in most of Jenkins build nodes, but docker is.

build image

based on CentOS, install headless chrome, selenium and chromedriver.

FROM centos:7

LABEL org.label-schema.schema-version="1.0" \"Selenium with Headless Chrome and CentOS" \
    org.label-schema.vendor="" \
    org.label-schema.license="GPLv2" \"20180817"

# install necessary tools
RUN yum install unzip -y
RUN curl -O
RUN python

# install headless chrome
RUN curl -O
RUN yum install google-chrome-stable_current_x86_64.rpm -y

# install selenium
RUN pip install selenium

# download chromedriver
RUN mkdir /opt/chrome
RUN curl -O
RUN unzip -d /opt/chrome

# copy the testing python script
RUN python

execute selenium from python

from selenium import webdriver
from import Options

chrome_options = Options()

driver = webdriver.Chrome(r'/opt/chrome/chromedriver', chrome_options=chrome_options)

print "page title: %s" % driver.title

docker image & source code

  • docker image:
  • source:


Public key for google-chrome-unstable-x.rpm is not installed

solution: import google key e.g.

rpm --import

for more detials:

ERROR Message: unknown error: DevToolsActivePort file doesn’t exist

add arguments:


for more details: