I have created the simpliest (minimal working example) Dockerfile
to run graphical application on my Ubuntu 16.04 LTS host system with 19.10 insider container:
mkdir ~/docker-xclock
cat > ~/docker-xclock/Dockerfile << EOF
FROM ubuntu:19.10
RUN apt-get update
RUN apt-get install -y x11-apps
CMD xclock
EOF
Then created container with
docker build -t ubuntu:xclock ~/docker-xclock
When I try to run this container it shows the error about display:
$ docker run ubuntu:xclock Error: Can't open display:
What is wrong?
We need to inform container about running X11 server on host with special syntax [1]:
where [2]:
Reference:
man docker-run
Complete reproducible solution:
if you're still getting error like:
make sure you run
*-from https://github.com/jessfraz/dockerfiles/issues/6#issuecomment-266230114
Create
Dockerfile
in the folderdocker-xclock
.NB:
ubuntu:xclock
put at the end of the command. Using X11 for GUI interaction .