How to make a port available to services outside of Docker

0 votes
Hi Guys,

I have my docker containers in my virtual machine, but I want to connect to my containers outside of my VM. How can I do that?
May 5, 2020 in Docker by akhtar
• 38,210 points
480 views

1 answer to this question.

0 votes

Hi@akhtar,

By default docker containers works in a isolated network. But if you want to connect to your container outside from host machine, you have to expose your container. Means you have to apply NAT/PAT concept to do this task. When you run your command to launch  container, you have to use -p flag like -p 8080:80. 

answered May 5, 2020 by MD
• 95,320 points

Related Questions In Docker

+1 vote
1 answer

How to expose docker container's ip and port to outside docker host without port mapping?

you can accomplish this with IP aliasing ...READ MORE

answered Aug 2, 2018 in Docker by Kalgi
• 52,370 points

edited Jan 16, 2020 by Kalgi 25,794 views
0 votes
1 answer

How to save a Dynamic port in Docker for Windows?

The mapped ports can be accessed via ...READ MORE

answered Sep 4, 2018 in Docker by Tyrion anex
• 8,690 points
251 views
+4 votes
4 answers

How To Access a Service on Host From a Docker Container?

Adding to kalgi's answer, You can also ...READ MORE

answered Oct 16, 2018 in Docker by lina
• 8,220 points

edited Oct 16, 2018 by lina 24,539 views
0 votes
1 answer

How to run a docker command from inside the container?

You must have come across the /var/run/docker.sock file, ...READ MORE

answered Jun 28, 2018 in Docker by Sophie may
• 10,550 points
2,196 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,140 points
1,355 views
0 votes
1 answer

How can I connect a docker container to two docker networks that I have created?

Hi@akhtar, It's correct that the network argument of ...READ MORE

answered Mar 23, 2020 in Docker by MD
• 95,320 points
1,698 views
+1 vote
1 answer

How to install packages in a Docker container?

Hi@akhtar, To install packages in a docker container, ...READ MORE

answered Apr 15, 2020 in Docker by MD
• 95,320 points
48,458 views