I want to run a docker container that has no access to the outside internet. I've been using --network=none for this successfully. But now I want to host a web server from that container, and access it from outside. When I try, I find that the port mapping is totally ignored:
$ docker run --rm -it -p 8000:8000 --network=none python bash
# python -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
Now from outside the container:
$ docker port 981f253788ad
$ curl localhost:8000
curl: (7) Failed to connect to localhost port 8000: Connection refused