View Full Version : [server] Docker starts before networking is ready at boot

April 27th, 2020, 05:05 PM
I'm trying to configure a Pi4 to run Ubuntu 18.04 and a bunch of docker containers with most of the persistent storage needed located on my nas via nfs shares. I've got everything working so far except that when I reboot the system, none of the containers with nfs volumes are able to start (/var/log/syslog shows "network is unreachable" for the container volumes). I've tried a lot of different solutions I've found and none of them seem to work. I'm a little bit new to systemd, but from what I can tell it doesn't seem to honor the networking dependencies defined. Please help!

April 27th, 2020, 05:22 PM
Add/change "After=network-online.target" to /lib/systemd/system/docker.service. Note that this file may be overwritten by future updates, there is an update-safe mechanism using systemctl but I am fuzzy about details here.

April 27th, 2020, 07:42 PM
The default file already contains "After=network-online.target firewalld.service containerd.service" and it doesn't work.

April 30th, 2020, 05:18 PM
I finally solved this. I had to edit the network configuration file for eth0 in /etc/netplan/ and remove the "optional: yes" entry. Now it all works. I also still have "After=nfs-client.target" entered in "systemctl edit docker.service"