【发布时间】:2019-06-04 22:07:27
【问题描述】:
我正在尝试从 CentOS 容器运行 GUI。我试图关注this example。这是我的 Dockerfile:
#!/bin/bash
FROM centos:7
#RUN yum install -y firefox dbus dbus-x11
RUN yum install -y firefox
# Replace 0 with your user / group id
RUN export uid=1000 gid=100
RUN mkdir -p /home/developer
RUN echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd
RUN echo "developer:x:${uid}:" >> /etc/group
RUN echo "developer ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN chmod 0440 /etc/sudoers
RUN chown ${uid}:${gid} -R /home/developer
#RUN dbus-uuidgen > /var/lib/dbus/machine-id
#RUN export $(dbus-launch)
USER developer
ENV HOME /home/developer
CMD /usr/bin/firefox
然后我在终端中运行以下命令。
docker run -ti --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
firefox
process 8: D-Bus library appears to be incorrectly set up; failed to read machine uuid: UUID file '/etc/machine-id' should contain a hex string of length 32, not length 0, with no other text
See the manual page for dbus-uuidgen to correct this issue.
D-Bus not built with -rdynamic so unable to print a backtrace
Running without a11y support!
No protocol specified
Error: cannot open display: :0.0
我尝试过this solution,在我的 Dockerfile 中添加以下行,
# apt-get install -y dbus
# dbus-uuidgen > /var/lib/dbus/machine-id
但这并没有解决问题。有什么想法吗?
编辑:我的主机操作系统是 Arch Linux。我真的想在 CentOs 中运行这个例子。我真的不需要一个运行 Firefox GUI 的容器。我只是想获得一个在 CentOS 容器中运行的 GUI 的最简单示例,但我失败了。
【问题讨论】:
-
你的主机上有什么操作系统?
-
@vvchik 我的主机操作系统是 Arch Linux。谢谢。