连接到远程服务器上的Docker内部的VNC [英] Connect to a VNC inside a docker which is on remote server

查看:686
本文介绍了连接到远程服务器上的Docker内部的VNC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在AWS EC2上有一个Amazon Linux AMI服务器,我已经在其上部署了"Selenium docker"" https ://github.com/elgalu/docker-selenium ",则该Docker内部运行有VNC.

I have an Amazon Linux AMI server on AWS EC2, i have deployed "selenium docker" on it "https://github.com/elgalu/docker-selenium", the docker have a VNC running inside it.

现在如何访问此VNC?

Now how i could access this VNC?

我做了一些谷歌搜索,但没有找到任何东西,我也尝试连接到服务器ip并提供VNC显示号,但它拒绝连接.

I did some google search but did not found anything, also i tried to connect to the server ip and give the VNC display number but it gives connection refused.

我已经在服务器安全规则中添加了VNC端口作为规则.

I have added the VNC port as a rule on the server security rules.

谢谢.

推荐答案

由于您已经为VNC服务器指定了防火墙规则,因此该问题很可能是在VNC端口监听中出现的.

Since you have already specified the firewall rules for your VNC server the problem is most likely in VNC port listening.

首先,确保VNC在localhost run上运行

first, make sure that VNC is running on localhost run

nc localhost 5901

nc = netcat(您可能需要安装软件包) 将5901更改为您的端口号

nc = netcat (you may need to install the package) change 5901 to your port no

您还可以通过以下方式查看正在运行的VNC实例:

you can also view the running VNC instances by :

vncserver -list

现在是否一切正常,请运行此命令以显示端口统计信息

now if everything seems to be working run this command to show the port stats

sudo netstat -ntpl | grep 5901 

将5901更改为您的端口名.

change 5901 to your portname.

如果是

127.0.0.1:5901分配给tcp,这就是问题所在,我们需要确保VNC在

127.0.0.1:5901 is assigned to tcp then that's the problem , we need to make sure VNC is running on

0.0.0.0:5901 

这意味着它应该接受所有流量,而不仅仅是本地主机!

which means it should accept all the traffic and not just localhost !

最后通过运行vncserver -kill :1(显示名称)杀死vncserver,运行命令:

finally kill the vncserver by running vncserver -kill :1 (display name), run the command :

vncserver -localhost no 

P.S是一个古老的问题,但可能会帮助将来的求职者.

P.S its an old question but may help future answer seekers.

这篇关于连接到远程服务器上的Docker内部的VNC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆