By seveibar
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 ...?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Sorry to see that your question hasn’t received an answer yet. I’ve just spun up a new Docker Droplet (17.12.0~ce on 16.04) and was able to access port 8000 using both commands you posted, as well as just docker run --net=host -it python python -m http.server. I had to open port 8000 on the firewall, though (ufw allow 8000).
It’s possible that it was a temporary issue that was resolved.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.