简体   繁体   English

从远程服务器连接到Docker中的Apache Web服务器

[英]Connecting to a Apache web server in a Docker from a remote server

I have installed Docker in a Linux environment. 我已经在Linux环境中安装了Docker。 Inside this host, there is a Ubuntu container running. 在该主机内部,有一个正在运行的Ubuntu容器。 Apache Web server is running inside this container. Apache Web服务器正在此容器中运行。 I have mapped port 80 of this docker container to the host machine's port 50000. 我已将此Docker容器的端口80映射到主机的端口50000。

When i try to access host machine from a remote browser, i'm unable to access it. 当我尝试从远程浏览器访问主机时,我无法访问它。 I want to see the apache web server running on Ubuntu container. 我想查看在Ubuntu容器上运行的apache网络服务器。 I access like this. 我这样访问。

http://192.168.16.3:50000 http://192.168.16.3:50000

Could someone let me know what might be the cause for this. 有人能让我知道这可能是什么原因。

You need to route traffic from host server port 80 to your docker container port 50000. This can be done with iptables. 您需要将流量从主机服务器端口80路由到Docker容器端口50000。这可以通过iptables完成。 http://blog.sequenceiq.com/blog/2014/08/12/docker-networking/ http://blog.sequenceiq.com/blog/2014/08/12/docker-networking/

I ve also read that docker can run in host mode http://www.dasblinkenlichten.com/docker-networking-101-host-mode/ 我还读到docker可以在主机模式下运行http://www.dasblinkenlichten.com/docker-networking-101-host-mode/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM