All ports exposed in Container?

I run an Ubuntu inside a VirtualBox VM on a Mac OS.

I create a container. I place a server inside it that listens on port 8000. Did not export port 8000.
In the host (Ubuntu), I use Firefox to go to localhost:8000 . No access. Expected behavior.

Then I use the container’s IP address “”. Access granted. I’m surprised.

Newbie here. Does it have anything to do with phusion/baseimage?

Hi @jhannwong

There is nothing wrong with the phusion baseimage.
The one you saw is the expected behaviour. If you dont expose the port using -p/-P while running container, the port will only be accessible using the container IP address.


In which case, that container IP should only be accessible from the Docker’s host and not from outside of the host. Correct?

Thanks for the guidance. Thanks for saving my sanity. :slight_smile:

You are right. container IP will be only accessible from docker host.