Adventures in TrueNAS Scale- fix docker containers not connecting to the internet

As part of my migration from my Synology to my custom built server/ NAS hybrid I needed to move all my docker containers, thankfully I had them in docker-compose files and wasn’t creating them through the inbuilt wizard on my Synology. TrueNAS scale runs Kubernetes for it’s applications and I didn’t want to invest time learning Kubernetes… yet.

So I managed to move my docker-compose files and their data across to TrueNAS easily enough, I update the paths in my secrets file and run docker-compose and my containers are up and running, “great, job done” I think to myself. But when are migrations ever that simple?

I try to connect to my containers and notice that they can’t connect to any external systems. After a bit of playing around to see what I had done wrong, I find that iptables are disabled by default in TrueNAS as they run Kubernetes and that that is a completely different networking beast.

So how do we fix it? Simple. SSH into your TrueNAS box with your shell of choice and run “nano /etc/docker/daemon.json” you simply need to change “iptables”: false to “iptables”: true

If you’re using nano hit control + x and Y to save the file. Now we just need to restart docker for this to take effect “systemctl restart docker”.
Now your containers should be able to talk to the internet again.
Note: this file does get overwritten when upgrading so you will need to apply this fix again if you upgrade.

Leave a Reply

Your email address will not be published. Required fields are marked *