问题
I used to run programs with commands like this:
docker run -ti \
--name wireshark \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME/.Xauthority:/root/.Xauthority \
--privileged \
-d ubuntu:17.10 /bin/bash
then I could run wireshark using my Ubuntu's system's display. Like this page's example: Running GUI App with docker
Now it is not working. When I run wireshark I get this error:
root@5ad127a8333a:/# wireshark
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
No protocol specified
QXcbConnection: Could not connect to display :0
Aborted (core dumped)
回答1:
It is possible to solve this with
xhost +
but it would then be wise to do
xhost -
after you no longer use this container.
In fact the more restrictive
xhost +local:docker
is enough
来源:https://stackoverflow.com/questions/47099483/run-gui-programs-in-docker-in-ubuntu