Nightwatch inside Docker only works with Phantom

513 Views Asked by At

I am running a suite of tests with nightwatch.js inside a Docker container.

When I run the tests with Phantomjs, they work perfectly. When I run the same tests using Chrome or Firefox, I get a "connection reset" error.

The base image for the Docker container is Ubuntu:16.04, I have xvfb installed and running.

I have applied the various tricks to counter the known errors when attempting to run a headless Chrome inside docker, including:

  • running the container with --privileged
  • running the container with --net=host
  • running the container with -v /var/run/dbus:/var/run/dbus
  • running it with -v /dev/shm:/dev/shm
  • setting the DBUS_SESSION_BUS_ADDRESS=/dev/null environment variable
  • making sure that chrome is running with the "--no-sandbox" argument and the "--disable-gpu" arguments

The thing is, both Firefox and chrome are actually running, (you see they can both take screenshots) - the problem is just the "connection reset" error.

Why do I get a connection reset error from Chrome and Firefox when Phantom can run the tests perfectly?

enter image description here

1

There are 1 best solutions below

0
On

I finally found the answer, I had to set the "no_proxy" environment variable inside docker and set it's value to localhost

ENV no_proxy "localhost;127.0.0.1"