Troubleshooting communication between containers and the external network
Packets can only pass between containers if the ip_forward
parameter is set to 1
. Usually, you will simply leave the Docker server at its default setting of --ip-forward=true
and Docker will set ip_forward
to 1
for you when the server starts up. To check the settings, use the following command:
# cat /proc/sys/net/ipv4/ip_forward 0 # echo 1 > /proc/sys/net/ipv4/ip_forward # cat /proc/sys/net/ipv4/ip_forward 1
By enabling ip-forward
, users can make communication between containers and the external world possible; it will also be needed for inter-container communication if you are in a multiple bridge setup:
ip-forward = true forwards all the packets to/from the container ...
Get Troubleshooting Docker now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.