Cypress error "The automation client disconnected. Cannot continue running tests." when running in Docker Cypress error "The automation client disconnected. Cannot continue running tests." when running in Docker docker docker

Cypress error "The automation client disconnected. Cannot continue running tests." when running in Docker


This seems to occur when running out of shm space.

By default, Docker creates a container with a /dev/shm shared memory space of 64MB.This is typically too small for Chrome and could cause Chrome to crash.

I have found two options to resolve this:

  1. Disable usage of /dev/shm:
// cypress/plugins/index.jsmodule.exports = (on, config) => {  // ref: https://docs.cypress.io/api/plugins/browser-launch-api.html#Usage  on('before:browser:launch', (browser = {}, args) => {    if (browser.name === 'chrome') {      args.push('--disable-dev-shm-usage')      return args    }    return args  })}
  1. Increase the size of /dev/shm in the container:

Run the container with docker run --shm-size=1gb (or whatever size you want)