Docker Community Forums

Share and learn in the Docker community.

Application access outside the container running machine

docker

(Prasannam) #1

Hi,

i have an docker image running in a container, i have a web application running in this container.
this above machine is a debian 9 - stretch machine. and i am able to access my web application locally in my debian 9 machine. but i am not able to access it outside this container running machine in the same network.

i have used below commands to achieve this

$ docker volume create --name=data1
$ docker network create --subnet=172.16.0.0/24 --gateway=172.16.0.254 mynet

$ docker run -d --name=web --net=mynet --ip=172.16.0.213 -v data1:/var/lib/oics oics/2.5.1

is there any additional configurations to be done in the docker to access my web app outside the local machine?

i will use this url to access it outside,
http://172.16.0.213:8080

thanks in advance


(Sam) #2

unless you do something special, the container is not visible on the same network of the host computer.

you will need to access the app via the host computers IP address and the exposed/mapped port of the container.


(Prasannam) #3

ENTRYPOINT [ “/usr/bin/dumb-init”, “/start” ]
and
CMD [ “web”, “–http-port=8080”, “–https-port=8443”, “–logging=console” ]

i believe this is the special thing you are talking about. is there anything other than this we need to do ?
i tried using the host computer IP address, but still i am not able to access.


(Sam) #4

i have no idea what that is…

usually u need to make sure the host firewall does not block incoming requests from outside.

I do this all the time without problem.