docker image to build node.js based projects and to able to run headless chrome
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Docker-Image to run NodeJS for dockerized builds and xvfb with google chrome.

It provides:

tool version
yarn 0.27.5
node.js 8.1.3
npm 5.0.3
google-chrome-stable 59
Xvfb apt-get
git apt-get
curl, wget apt-get
zip, bzip2 apt-get
jq apt-get





Assuming you are currently inside a NodeJS Project containing a package.json, you can do an npm install like this:

docker run \
    -i -t \
    -v $(pwd):/work \
    --shm-size=128M \
    codeclou/docker-nodejs-chrome-xvfb:node-8.1.3-chome-59 \
    npm install

Or take a screenshot via:

docker run \
    -i -t \
    -v $(pwd):/work \
    --shm-size=128M \
    codeclou/docker-nodejs-chrome-xvfb:node-8.1.3-chome-59 \
    google-chrome --no-sandbox --headless --disable-gpu --window-size=1280,768 \


Usage with Karma.js

Since Chrome 59 we must use several things, which is handled by docker entrypoint:

  • We need to start pulseaudio, or Chrome will complain about Audio Managers
  • We need to start dbus
  • We need to start xvfb
  • We need some flags for chrome startup
  • We need a symlink to chromium binary

When using with karma.js:

  • Start docker with a greater /dev/shm cache and use --shm-size=128M or greater.
  • Configure karma config with Chrome flags:
  logLevel: config.LOG_DEBUG,
  browsers: ['Chrome_without_security'],
  singleRun: false,
  customLaunchers: {
    Chrome_without_security: {
      base: 'Chrome',
      flags: [
        //'--headless', // DO NOT USE headless !!!


Usage with Protractor

In your protractor.conf.js

// ...

exports.config = {
  // ...
  capabilities: {
    'browserName': 'chrome',
    'chromeOptions': {
      'args': ['--disable-gpu', '--no-sandbox']
// ...



MIT © Bernhard Grünewaldt