How can I expose more than 1 port with Docker?

So I have 3 ports that should be exposed to the machine’s interface. Is it possible to do this with a Docker container?

6 s
6

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>

Leave a Comment