Docker Community Forums

Share and learn in the Docker community.

Block private internet adresses


I’m trying to have a docker image blocked from intranet access.
IP ranges are to and to and to
How do I block intranet access for a image either with compose or a simple dockerfile?

I can open port access to a image but how do i block it from affecting the network and host.

docker run -it alpine /bin/sh
/ # ping
PING ( 56 data bytes
64 bytes from seq=0 ttl=37 time=4.574 ms
64 bytes from seq=1 ttl=37 time=1.977 ms

I’m running Windows 10 and Ubuntu 18.10. I will post my image on github so I don’t know what the users will run.


why would you want to solve a network concern inside a container?
This clearly needs to be prevented on the host level or even better on the network level.