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
• 7,340 points
10,634 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,980 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 27, 2018 in DevOps & Agile by Atul
• 10,240 points
752 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,220 points
2,226 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
• 52,350 points
3,643 views
+2 votes
1 answer
+2 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
• 58,020 points
2,739 views
0 votes
1 answer

How do I assign a port mapping to an existing Docker container?

Below are some steps which you can ...READ MORE

answered Sep 19, 2018 in DevOps & Agile by Damon Salvatore
• 5,980 points
9,337 views
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,980 points
7,522 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP