So, as the title states, I'm a docker
newbie.
I downloaded and installed the archlinux/base
container which seems to work great so far. I've setup a few things, and installed some packages (including xeyes
) and I now would like to launch xeyes
. For that I found out the CONTAINER ID by running docker ps
and then used that ID in my exec command which looks now like:
$ docker exec -it -e DISPLAY=$DISPLAY 4cae1ff56eb1 xeyes
Error: Can't open display: :0
Why does it still not work though? Also, how can I stop my running instance without losing its configured state? Previously I have exited the container and all my configuration and software installations were gone when I restarted it. That was not desired. How do I handle this correctly?
Concerning the X Display you need to share the
xserver
socket (note:docker
can't bind mount avolume
during anexec
) and set the$DISPLAY
(exampleDockerfile
):Build the
docker
image:docker build --rm --network host -t so:57733715 .
Run the
docker
container:docker run --rm -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY so:57733715
Note: in case of
No protocol specified
errors you could disable host checking withxhost +
but there is a warning to that (man xhost
for additional information).