How do I expose multiple port with Docker?

0 votes

I want multiple ports that should be exposed to the machine's interface.

How can I achieve this using Docker container?

Can anyone help me with this?

Thanks.

Sep 11, 2018 in DevOps & Agile by shubham
• 6,870 points
1,656 views

1 answer to this question.

0 votes

If you want to expose only one port, this is what you need to do:

docker run -p <host_port>:<container_port>

If you want to expose multiple ports, simply provide multiple -p arguments which you can use below command:

docker run -p <host_port1>:<container_port1> -p <host_port2>:<container_port2>

I hope the above explanation will be helpful for you.

Thanks.

answered Sep 11, 2018 by Damon Salvatore
• 5,490 points

Related Questions In DevOps & Agile

0 votes
1 answer
0 votes
1 answer

How do I use Devops with Xamarin and hockeyapp

It would be better if you use ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by Atul
• 10,240 points
62 views
+1 vote
2 answers

How do I run Apache server from Docker without mapping to a location?

If you're seeing a 500 error, that's ...READ MORE

answered Oct 18, 2018 in DevOps & Agile by lina
• 8,100 points
59 views
+3 votes
2 answers

How do I set max lifetime for Docker Container?

There is one more way which you ...READ MORE

answered Oct 18, 2018 in DevOps & Agile by Kalgi
• 37,320 points
270 views
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,160 points
98 views
0 votes
1 answer
0 votes
1 answer

How do I restart a single container with docker-compose?

Actually it's not that difficult. Here is ...READ MORE

answered Nov 8, 2018 in DevOps & Agile by Damon Salvatore
• 5,490 points
402 views