Run GUI programs in Docker in Ubuntu

旧街凉风 提交于 2020-06-13 10:28:13

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!