Hello.
I got some docker containers and bind specific ip addresses to them.
Everything works fine until I reboot the server.
After reboot - docker container did not start automatically, and I see next error:
And if I did service docker restart - they all started.
So, I think the problem is that docker starts too fast, before the network does, and when it tries to run the container - there is no ip address and it fails.
So, the question is, how can I fix it ?
via apt, ubuntu 22.04, default flow
I try to edit systemd unit changing Wants to Requires for network-online.target - but no luck
Then I try add delay with drop-in:
[Service]
ExecStartPre=/bin/sleep 30
and this helped, but I think this is not right way.
That is not how “exactly” you installed, just the package manager and I don’t know what you consider the “default flow”. If you followed a documentation or tutorial, please share the link.
The output of the following command could help too:
ii docker-buildx-plugin 0.12.1-1~ubuntu.22.04~jammy amd64 Docker Buildx cli plugin.
ii docker-ce 5:25.0.2-1~ubuntu.22.04~jammy amd64 Docker: the open-source application container engine
ii docker-ce-cli 5:25.0.2-1~ubuntu.22.04~jammy amd64 Docker CLI: the open-source application container engine
ii docker-ce-rootless-extras 5:25.0.2-1~ubuntu.22.04~jammy amd64 Rootless support for Docker.
ii docker-compose-plugin 2.24.5-1~ubuntu.22.04~jammy amd64 Docker Compose (V2) plugin for the Docker CLI.
I am just working on a new bare metal server setup, using ansible and creating a Wireguard mesh network between the servers, so this will be very relevant for me, too