[英]How to enable xvfb for an express server running inside a docker container?
[英]How to enable remote Desktop sharing (like VNC server) for an OS running inside a docker container
我能夠從 docker 集線器中提取centos
圖像 -
docker pull centos
然后我執行運行命令以交互模式啟動容器 -
docker run -i -t centos
之后,我可以通過終端與在容器內運行的centos
進行交互,例如 -
[root@640fc383c7b4/]# other commands here..
現在我想知道是否可以遠程與容器內的centos
交互,就像使用 VNC 查看器一樣,我會像在虛擬機內部運行其他操作系統一樣。
我嘗試使用命令yum -y install tiger-vncserver
vncserver
在此之后運行命令vncserver
-
[root@640fc383c7b4 home]# vncserver
New '640fc383c7b4:2 ()' desktop is 640fc383c7b4:2
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/640fc383c7b4:2.log
現在我嘗試使用容器的 IP 地址連接到指定的端口2
,但它不起作用。
任何幫助,將不勝感激。
要使用任何端口連接到正在運行的容器,您需要在運行命令期間 map 它,然后通過主機 IP 或localhost
訪問它。
例如:
如果您運行 http 服務器,該服務器在容器內的端口 8080 上列出,以便能夠在您的機器中的8080
上訪問它,您需要 map 像這樣8080:8080
右側是容器端口,左側是主機端口。
該命令將如下所示:
docker run -dit --name my-http-server-instance -p 8080:8080 my-http-server:latest
對於其他所有端口也是如此。
在你的情況下
2
因此您需要找到 VNC 服務器端口(可能是5900
)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.