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

Added fix for running cypress interactive UI from docker #1280

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,13 @@ If you need to test that the image works with Cypress, you can follow these inst
1. Install XQuartz: https://www.xquartz.org/
2. Launch XQuartz. Under the XQuartz menu, select Settings
3. Go to the security tab and ensure "Allow connections from network clients" is checked.
4. From the XQuarts terminal, run `xhost + ${hostname}` to allow connections to the macOS host
5. From the XQuarts terminal, set up a `HOSTNAME` env var `export HOSTNAME="host.docker.internal:0"`
6. From the XQuarts terminal, run your Docker image like such:

4. `export IP=$(ipconfig getifaddr en0)`
5. `xhost + $IP` to allow connections to the macOS host, this adds IP related to our en0 network interface to the access control list
- If we get `xhost` command not found error, try running this instead `/usr/X11/bin/xhost + $(ipconfig getifaddr en0)`
6. Set up a `DISPLAY` env var `export DISPLAY="$IP:0"`
7. Run your Docker image like such:
```bash
docker run --rm -it -e DISPLAY="host.docker.internal:0" -v /tmp/.X11-unix:/tmp/.X11-unix --entrypoint bash <YOUR_IMAGE_TAG>
docker run --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --entrypoint bash <YOUR_IMAGE_TAG>
```

When executing `npx cypress open` from the Docker container, the display should now be visible!
Expand Down