如何在Docker上公开1个以上的端口? [英] How can I expose more than 1 port with Docker?
本文介绍了如何在Docker上公开1个以上的端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
只显示一个端口,这就是您需要做的:
docker run -p< host_port>:< container_port>
要公开多个端口,只需提供多个 -p
参数:
docker run -p< host_port1>:< container_port1> -p< host_port2>:< container_port2>
So I have 3 ports that should be exposed to the machine's interface. Is it possible to do this with a Docker container?
解决方案
To expose just one port, this is what you need to do:
docker run -p <host_port>:<container_port>
To expose multiple ports, simply provide multiple -p
arguments:
docker run -p <host_port1>:<container_port1> -p <host_port2>:<container_port2>
这篇关于如何在Docker上公开1个以上的端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文