Docker Community Forums

Share and learn in the Docker community.

X11 over remote Docker container stops working after resetting VPN

I’m running on ubuntu 18.04, with a “operator” machine VPN’ed into a network that has the “Test” machine.

The test machine runs a Docker container that has a GUI application that I forward over X11. I use SSH on the operator machine to SSH into the test machine. Then, I run the Docker container. Normally, the GUI shows up on my “operator” machine when I run the Docker container.

However, I’ve noticed that as soon as I disconnect my VPN and reconnect,I get a “Could not connect to display $DISPLAY” error.

I would need to create a new container from the image to have the X11 working again.

Here is how I launch it:

xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
chmod 777 $XAUTH
sudo docker run  --gpus all -it --privileged --network=host -e DISPLAY=$DISPLAY -v $XSOCK:$XSOCK -v $XAUTH:$XAUTH -e XAUTHORITY=$XAUTH  image

Nothing changed on the “test” machine or docker container in this situation. Even if the VPN reconnect assigned me the same IP as prior, it would still have this issue.

Any idea what’s causing this?