Restricting docker access to internal IP's on host

Viewed 15

I have set up a docker standalone host, which runs several docker containers. This same host also runs several servers to interface, for example, GPS modules. These internal interfaces, such as this GPS module using gpsd, listen to an IP address that belongs to a restricted docker network.

Situation:

  • Docker network named "gpsnw0" is made with the "internal" option to restrict access and has an address range 172.89.0.0/16.
  • GPS server listens to IP 172.89.0.1
  • Docker container runs in network "docker0", on IP 172.17.0.2

My questions:

  1. Why could the docker container reach the GPS server if the GPS server is listening to a restricted network address?
  2. Is the traffic flowing from interface docker0 through interface gpsnw0 to the GPS server?
  3. If so, then why don't the iptables block communication to the GPS server with one of the following rules:
  • iptables -I DOCKER-USER 1 -o gpsnw0 -j DROP
  • iptables -I DOCKER-USER 1 -i gpsnw0 -j DROP
  • iptables -I DOCKER-USER 1 -o br-<id_of_gpsnw> -j DROP
  • iptables -I DOCKER-USER 1 -i br-<id_of_gpsnw> -j DROP

Thank you in advance.

Robbert

0 Answers
Related