[英]Can't access app deployed with docker and google cloud
I currently have a Linux Debian VM set up through Google Cloud Platform. 我目前通过Google Cloud Platform设置了Linux Debian VM。 I have docker installed and would like to start running application containers within it. 我已经安装了docker,并想开始在其中运行应用程序容器。
I'm following the documentation under Docker's website Found Here under "Running a web application in Docker" I download the image and run it with no issue. 我正在遵循Docker网站上的文档,在“在Docker中运行Web应用程序”下的“ 找到此处 ”中,我下载了映像并运行了它。 I then run $sudo docker ps
and get the port which is 0.0.0.0:32768->5000/tcp 然后我运行$sudo docker ps
并获取端口为0.0.0.0:32768->5000/tcp
I then try to browse to the website at http://"MyExternalVMIP":32768 but the applications doesn't come up. 然后,我尝试浏览至http://“ MyExternalVMIP”:32768的网站,但应用程序没有显示。 Am I missing something? 我想念什么吗?
First, test to see if your service works at all. 首先,测试一下您的服务是否可以正常工作。 To do this, from the VM itself, run: 为此,请从VM本身运行:
wget http://localhost:32768
or 要么
curl http://localhost:32768
If that works, that means the service is operating properly, so let's move further with the debugging. 如果这可行,则意味着服务运行正常,因此让我们进一步进行调试。
There may be two firewalls that are blocking external access to your docker process: 可能有两个防火墙阻止了对docker进程的外部访问:
You can see if you're affected by the first issue by accessing the URL from the VM itself and from another VM on the same GCE network (use the VM name in the URL, not the external IP): 您可以通过从VM本身和同一GCE网络上的另一个VM访问URL来查看是否受到第一个问题的影响(使用URL中的VM名称,而不是外部IP):
wget http://[vm-name]:32768
To fix the first issue, you would have to either open up the single port (recommended): 要解决第一个问题,您将必须打开单个端口 (推荐):
iptables -I INPUT -p tcp -s 0.0.0.0/0 --dport 32768 -j ACCEPT
or disable firewall entirely, eg, by stopping iptables (not recommended). 或完全禁用防火墙,例如,通过停止iptables(不推荐)。
If, after fixing this, you can access the URL from another host on the same GCE network, but still can't access it from outside of Google Compute Engine, you're affected by the second issue. 解决此问题后,如果您可以从同一GCE网络上的其他主机访问该URL,但仍然无法从Google Compute Engine外部访问该URL,那么您会受到第二个问题的影响。 To fix it, you will need to open the port in the GCE firewall ; 要修复它,您将需要在GCE防火墙中打开该端口 。 this can also be done via the web UI in the Developers Console . 这也可以通过开发者控制台中的Web UI来完成。
Create an entry in your local ssh config file as below with specific local forward port. 如下所示在本地ssh配置文件中使用特定的本地转发端口创建一个条目。 In my case its an example of yarn's IP, which I want to access in browser. 就我而言,这是一个纱线IP的示例,我想在浏览器中访问它。
Host hadoop
HostName <External-IP>
User <Local-machine-username>
IdentityFile ~/.ssh/<private-key-for-above-user>
LocalForward 8089 <Internal-IP>:8088
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.