I’ve been spending a lot of time working with Docker over the last year, primarily in Ubuntu environments. So long in fact, that I seem to have forgotten this blog exists 🙂
Something it took me a while to figure out was how to stop Docker from bypassing UFW and exposing mapped ports to the world (due to specifying its own iptables chain). More often than not, I want containers to be restricted to private network access only. One option is to specify an ip address when mapping ports, but that’s a bit clunky and doesn’t work so well when you want to be able access the ports via multiple private ip addresses.
The challenge was making sure not to block outbound or inter-container connectivity in the process.
Having had to set up a number of servers and keep finding myself forgetting one of the steps, I figured it was about time I put this blog to good use and list the necessary commands here:
sudo ufw allow in on docker0 sudo sed -i s/DEFAULT_FORWARD_POLICY=\"DROP\"/DEFAULT_FORWARD_POLICY=\"ACCEPT\"/ /etc/default/ufw sudo ufw enable iptables -t nat -A POSTROUTING ! -o docker0 -s 172.17.0.0/16 -j MASQUERADE
2 Comments
thank you! This is just what I needed.
Thanks Luke, this did the trick!
12 Trackbacks
dominos coupons vouchers australia
Make Docker play nicely with UFW
thevacationgals.com
Make Docker play nicely with UFW
coupon codes jack wills
Make Docker play nicely with UFW
mcdk-kr.ru
Make Docker play nicely with UFW
http://wms.hwajing.com.my/
Make Docker play nicely with UFW
back pain relief in Beverly Hills
Make Docker play nicely with UFW
jooog.com
Make Docker play nicely with UFW
low cost furniture nyc
Make Docker play nicely with UFW
online shopping shoes canada
Make Docker play nicely with UFW
2018 calendars wall desk planners shop calendars
Make Docker play nicely with UFW
see post
Make Docker play nicely with UFW
customer oriented auto
Make Docker play nicely with UFW