HassOS on RPi change docker network

I have HassOS on RPi 4 running and also installed NodeRed and some other plugins/addons. Overall very happy and moving all my homekit devices to work through Hass and then expose to Homekit so I have a solid foundation.

The issue I have run into is that docker on HassOS use 172.30.x to allocated IPs to its containers and I have my subnets in 172.17.x and 172.17.y. This is causing communication issues since trying to reach those subnets seems to not make a call outside of docker at all.

I found this out by installing the SSH terminal and running a traceroute.

Question is, is there any way for me to configure the IP allocation block for docker on HassOS or customize it perhaps so my internal communications will work?

1 Like

For anyone else that runs into this.
The main issue is that by default docker seems to reserver 172.17.0.1/16 for the bridge network it creates. This is all IPs between 172.17.0.1-172.17.255.254 (alot of IPs) and this conflicted with my internal IP range so I had to change it.

The only way I figured out is as follows:

  1. Connect directly to the host running HassOS (monitor, keyboard, mouse).
  2. At the login prompt type: root
  3. at the HA prompt type: login
  4. Now you should be at the shell.
  5. Go to /etc/docker
  6. Create a file called: daemon.json with the following content:
{ "bip": "172.16.0.1/16" }
  1. Save the file.
  2. Restart docker: systemctl restart docker

Now you should be good. you may have to reboot the host to get all the other docker images running but at least 172.17.x IP range is now external to docker and will get routed properly.

2 Likes

Thanks alot! This solution is a life saver!

Basically this can work. But unfortunately in HAOS /etc/docker/daemon.json is inside a read only filesystem. It is not possible to change this file since the file system is squashfs.
I have the same problem but currently I see any possible solution except there would be a kind of overlay for this config file build into HAOS.
Currently I change the network of docker0 every time i reboot the HAOS system with the ip command.
ip addr add dev docker0 10.234.1.1/24
ip addr del dev docker0 172.17.0.0/16
But that seems have to be done manually from the console.

1 Like