【发布时间】:2022-09-23 02:00:24
【问题描述】:
我正在尝试创建一个docker 容器,它可以让我运行firefox,所以我最终可以使用jupyter notebook。现在,虽然我已经成功安装了firefox,但我无法打开一个窗口。
按照running-gui-apps-within-docker 的说明,我用Firefox 创建了一个图像(即\"sample\"),然后尝试使用
$ docker run -it --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --net=host sample
当我这样做时,我收到以下错误:
root@machine:~# firefox
No protocol specified
Unable to init server: Could not connect: Connection refused
Error: cannot open display: :1
使用man docker run 来理解标志,我找不到--net 标志,尽管我确实看到了--network 标志。然而,用--network 替换--net 并没有改变任何东西。如何指定一个协议,让我创建一个可以从其容器运行firefox 的图像?
PS - 对于它的价值,当我检查 DISPLAY 的值时,我得到了可预测的:
~# echo $DISPLAY
:1