Docker Community Forums

Share and learn in the Docker community.

How to access a container from internet

(Antonios Manaras) #1


How can I access a container running a web app over the internet? I want to fire up the container with the web application on a remote server and access the web application over the internet, how is this possible?

(Jeff Anderson) #2


When you fire up your container, you will publish the port that it is running on.

Say I have a docker host running out on the internet with the IP address I can launch a web application, docker run -d nginx. At that point, nginx is running on just its container’s IP address.

If I run the application, but publish that port with -p, I can access it from the outside: docker run -d -p 80:80 nginx

$ curl
<!DOCTYPE html>
<title>Welcome to nginx!</title>

I can change the port I publicly publish as well. If I want to access nginx on the host’s port 8080, I can do this: docker run -d -p 8080:80 nginx

More details on how that works can be found here and here


(Terraboss) #3

Hi @programmerq,
Hi there,
could you explain me this from beginner’s perspective?

I’m OS X 10.11 user and running docker via Kitematic 0.10.0 (DockerToolbox-1.10.3).

I’ve recently installed a couple of docker containers. Now, I’d to access Ghost from the local area network (using a DHCP provided IP) and afterwards, I’d like to open the specific application port to access this container from the internet.

I would really appreciate a step by step guide.


(Dvohra) #4

Set up port forwarding. Refer the remote port forwarding.