Report this

What is the reason for this report?

Docker --net=host does not forward ports

Posted on January 6, 2017

On my local machine setting --net=host on a container makes the container visible on any ports it is using. On a Docker Ubuntu 16.04 droplet the port is not accessible with --net=host.

Simplified Example:

This works: docker run -p 8000:8000 -it python python -m http.server

This does not work: docker run --net=host -p 8000:8000 -it python python -m http.server

How can I make the ports of the container application exposed with docker run --net=host ...?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.