How to access a container from internet

Hi,

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?

Hello,

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 198.51.100.30. 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 198.51.100.30
<!DOCTYPE html>
<html>
<head>
<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

/Jeff

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.

Thanks

Set up port forwarding. Refer the remote port forwarding.
https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding