[英]prevent Docker from exposing port on host
If i start a container using -p 80
for example, docker will assign a random outbound port. 例如,如果我使用
-p 80
启动容器,则docker将分配一个随机的出站端口。
Everytime Docker assign a port, it also add an iptable rule to open this port to the world, is it possible to prevent this behaviour ? 每次Docker分配一个端口时,它还会添加一个iptable规则来将该端口开放给世界,是否有可能防止这种行为?
Note : I am using a nginx load balancer to get the content, I really don't need to have my application associated with two different port. 注意:我正在使用nginx负载平衡器来获取内容,我真的不需要将我的应用程序与两个不同的端口关联。
You can specify both interface and port as follows: 您可以如下指定接口和端口:
-p ip:hostPort:containerPort
or 要么
-p ip::containerPort
Another solution is to run nginx inside container and to use conteiner linking without exposing other services whatsoever. 另一个解决方案是在容器内运行nginx并使用conteiner链接,而不公开任何其他服务。
The iptable feature is a startup parameter for the docker demon. iptable功能是docker恶魔的启动参数。 Look for the docker demon conf file in your docker installation.
在docker安装中查找docker demon conf文件。 Add --iptables=false and docker never touches your iptables.
添加--iptables = false,docker永远不会触摸您的iptables。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.