Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress interactive mode not working in Docker-desktop (Unable to open X Display) #763

Closed
HendrikJan opened this issue Oct 10, 2022 · 7 comments

Comments

@HendrikJan
Copy link

Hi,

I used to run the Cypress interactive GUI inside docker like this on Linux:

docker run -it --rm --name cypress \
    --privileged \
    --network host \
    --ipc=host \
    -e DATABASE_URL="mysql://development:secret@tapp.docker:8004/test" \
    -e CYPRESS_runType='browser' \
    -e DISPLAY=unix$DISPLAY \
    -e XAUTHORITY=/.Xauthority \
    -v ~/.Xauthority:/.Xauthority:ro \
    -v $PWD:/e2e \
    -w /e2e \
    --entrypoint '' \
    cypress/included:9.7.0 \
    bash -c "cypress open --project /e2e"

This works in plain Docker.

Now I installed Docker Desktop and I get this error:

Unable to open X display.

Docker Desktop creates a container that contains all the other containers, so another layer of container.
I can imagine that this is causing the problem, but I don't know how to fix it.
As Docker Desktop seems to be the new preferred way to run Docker, and also my colleagues moved over to Docker Desktop, I would like to get Cypress GUI to work on Docker Desktop.

Can I run Cypress in the cypress/included docker container inside Docker Desktop? How?

@rnunezil
Copy link

Hi Hendrik, I am also trying to run Cypress GUI from inside Docker Desktop. Do you have X11 server installed? You need to forward the XVFB messages from Cypress out of the Docker container into an X11 server. See this example if you haven't already: (https://www.cypress.io/blog/2019/05/02/run-cypress-with-a-single-docker-command/)

I setup the X11 Server and trying to open Cypress this way(I have a docker-compose.yml file). docker compose run -v /tmp/.X11-unix:/tmp/.X11-unix --rm e2e cypress open.

However, Cypress never opens. (That dri3 extension I get even if I run Cypress headless which that works)
image

If I try to pass -e DISPLAY, I get a 'The Test Runner unexpectedly exited via a close event with signal SIGSEGV'

@tyler36
Copy link

tyler36 commented Oct 26, 2022

I had a similar problem where Cypress failed to open on Docker Desktop 4.13.0. It opened if I used a local copy but would timeout if I ran it through Docker.

I uninstall Docker Desktop and install Docker Desktop 4.11.0, which appeared to work.
I then did the same thing with 4.11.1 and 4.12.0 and they worked too.
Tried 4.13.0 to see if it was broken but it worked.

So, perhaps something broken during the upgrade process?

TLDR: Uninstall and reinstall may fix the issue.

@HendrikJan
Copy link
Author

Hi @tyler36, thanks for the reply!

Are you saying that interactive mode is now working in Docker for you?
On what machine are you working, Linux, Mac or Windows?

@tyler36
Copy link

tyler36 commented Oct 26, 2022

Yes, I'm on a Win10 with Docker Deskop 4.13.0 running from WSL (Ubuntu 20.04).
Test Cypress 10.2.0, 10.8.0, 10.10.0 & 10.11.0

@HendrikJan
Copy link
Author

HendrikJan commented Oct 26, 2022

I'll try reinstalling then.
For me and my colleague, both on Linux, Cypress runs but interactive mode doesn't.
At the moment we use a noVNC container to access interactive and that works good enough for the moment.

Anyway thanks 👍

@MikeMcC399
Copy link
Collaborator

@HendrikJan

@MikeMcC399
Copy link
Collaborator

Closing.
We can re-open if there is new information available.

@MikeMcC399 MikeMcC399 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants