Today I started playing with Docker in earnest and ran into a small problem that was easy to fix. I don’t often play with my network so I had to look this one up. I started by following the instructions for installing docker on my Mac. Then I went to the introductory tutorial and followed along in real time. I noticed as I was playing that I got this message:
WARNING: IPv4 forwarding is disabled.
Turns out that by default the ipv4 forwarding is not turned on in the image from docker to prevent any security vulnerabilities. I totally get that but I wanted to turn it on and get rid of the message. Here is what I did:
$ sudo sysctl -w net.ipv4.ip_forward=1
Super simple solution. But this won’t work every time, you need to update the actual /etc/sysctl.conf file to make it permanent. Just open up the file and uncomment the line with
net.ipv4.ip_forward=1. You’re all done. Exit and reload your vagrant image. The error should now disappear.
Read more about this problem if you’re interested.