Docker messes VMs network when started at boot

Background:

  • two VMs running with dedicated bridges (br0 and br1) and linked to different interfaces
  • host itself is linked to br0
  • system works and have been working fine for a long time

Problem:

  • installed docker and container (Filestash) and everything seems fine
  • when system is booted and docker is started automatically, VMs are no longer able to reach router and internet. br0 connected VM is able to ping host though. Seems that routing is broken.

Temporary solution:

  • if I start docker manually after boot when VMs work fine there’s no issue. Routing works fine after docker has started. Filestash works fine as well.

I have not made any network changes to docker config (did not even find it…) but I’m using default.

I would like to understand what is the problem here and how to solve it. Tried to find a way to set the order of starting of services but couldn’t find that either. There used to be rc.x but these are all gone… Not sure if revised starting order would be a solution (well, does not really solve the root cause but is a bandage to the problem).

Anyone with more experience on the topic - where to start looking for a solution and most importantly what actually is the problem here?

I was not the only one having similar issues and luckily someone had solved it. Workaround but fine.

sudo nano /etc/systemd/system/start-docker.timer

[Unit] Description=Start docker after boot [Timer] OnBootSec=120 Unit=docker.service [Install] WantedBy=timers.target

(apparently this editor does not handle line breaks properly so don’t just copy but add needed line breaks)

And finally:
sudo systemctl --system enable --now start-docker.timer

This will start docker 2min after boot which is enough. Probably shorter time is needed but this is fine for me.