Tyblog

Technology, open source, unsolicited opinions & digital sovereignty
blog.tjll.net

« Running Docker on CentOS - External Network Access »

  • 3 October, 2014
  • 186 words
  • 1 minute read time

This is just a short blip for people running Docker on CentOS who have encountered problems accessing containers from outside the localhost.

The long and short of it is this command:

$ sysctl net.ipv4.ip_forward=1

Why? Read this answer on StackExchange first. When Docker configures your iptables rules for network access, it likes to create a docker0 interface alongside any other network interfaces (like eth0) that CentOS creates by default.

Therefore, you must enable IP forwarding to allow those packets arriving on your externally-listening interface to be forwarded (or routed) to the docker interface that all of your containers are attached to.

Hopefully this helps somebody else out who may encounter similar problems.