Exposing docker container to outside world

Inputs

  • VM IP where docker is installed - 192.168.1.5
  • Docker default bridge IP - 172.17.0.X
  • OS : CentOS 7
  • Docker version : 1.12.1

Current Scenario

Currently we are accessing docker container using port mapping to VM IP (example is web is setup on port 90 of VM then we access URL as 192.168.1.5:90). We have a .Net application which is hosted on Windows server which needs to be linked to docker container. We are able to achieve it using port mapping but that is nto what we are looking for.

Requirement

To be access to access docker container on same IP range as of VM (something like 192.168.XX.XX)

I tried lot of options but nothing worked out. Didn’t find any proper document online where they can how to achieve this.

Whatever am trying to achieve is possible? If so please help me.

[quote=“sunilthemaster, post:1, topic:23419, full:true”]
Currently we are accessing docker container using port mapping to VM IP (example is web is setup on port 90 of VM then we access URL as 192.168.1.5:90). We have a .Net application which is hosted on Windows server which needs to be linked to docker container. We are able to achieve it using port mapping[/quote]

Yes, the docker run -p option is the right answer to this.

In my experience docker run command lines frequently get long, and writing a wrapper script to start a container or using a tool like Docker Compose that will let you list all the options out in a file is useful.