Skip to content

Instantly share code, notes, and snippets.

View AtofStryker's full-sized avatar

Bill Glesias AtofStryker

View GitHub Profile
@AtofStryker
AtofStryker / x11forward.md
Created May 29, 2024 19:56
Set up Xll Forwarding on Ubuntu Jammy Jellyfish

To forward X11 from inside a docker container to a host running Ubuntu Jammy Jellyfish (22.04.4)

  1. apt-get update
  2. apt-get install xorg openbox
  3. When running your docker image
docker run --rm -it --net=host --env="DISPLAY" --volume="$HOME/.Xauthority:/root/.Xauthority:rw" --entrypoint bash <YOUR_IMAGE_TAG>

When executing npx cypress open from the docker container, the display should now be visible!

@AtofStryker
AtofStryker / gist:da2e94e8535cffeebf676b6399f96b47
Last active April 30, 2024 14:04
Setting up XQuarts to connect to MacOS display from cypress docker container

To forward X11 from inside a docker container to a host running macOS

  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, Setup a HOSTNAME env var export HOSTNAME="host.docker.internal:0"
  6. From the XQuarts terminal, run your docker image like such:
docker run --rm -it -e DISPLAY="host.docker.internal:0" -v /tmp/.X11-unix:/tmp/.X11-unix --entrypoint bash 
BEGIN MESSAGE.
W6CCUGsrKwbxRWJ myLxhwZ5VbrJc7v xmAdITQJ7fILfi9 GAFFuiHdaSBb5EG
LSrnUpaRtKqERYW M0f4iaxAp9qTCKq 6Xr2MZHgg6V5MEK yWeZOxZlKhJyweI
U76CHBoYsN6YlET eKNoO1mTEeNni9I C8idCwRUDWM6vFt 4J6foDJPxDZ586V
B9UKHu9ktxmS1ZL 3D5lnMWXuGCmi03 TfB4T0aLMzWSiL.
END MESSAGE.
BEGIN MESSAGE.
9PbHTlwkRUWUdKj Vl9iDmZel5gl4xL 0LwNB1wnr7Hh1jh FSgQoGbnyRMoeWZ
NhZesYWvUCCQSDx IvVfiU5EHo6TCKq 6Xr2MZHgg6NmmPH DzVLPKC9w4I1ZeJ
v1nUp7MLEPex1at mBau3qjcQf6jmCD DOIRzmZsY8TJULu sgUpdTwCQxujG3R
UUNuDXSkNoVHvcu x6KBnTLg1qneOTl 89SYb0aLMzWSiL.
END MESSAGE.