fails to start if dns not up on boot
Is there an existing issue for this?
- [X] I have searched the existing issues
What happened?
After rebooting my computer I see:
Dec 03 11:04:51 iot2 teslamate[1128]: waiting for postgres at postgresql.pri:5432
Dec 03 11:04:52 iot2 teslamate[1128]: waiting for postgres at postgresql.pri:5432
Dec 03 11:04:53 iot2 teslamate[1128]: waiting for postgres at postgresql.pri:5432
Dec 03 11:04:54 iot2 teslamate[1128]: waiting for postgres at postgresql.pri:5432
Dec 03 11:04:55 iot2 teslamate[1128]: waiting for postgres at postgresql.pri:5432
Dec 03 11:04:56 iot2 teslamate[1128]: waiting for postgres at postgresql.pri:5432
Dec 03 11:04:57 iot2 teslamate[1128]: waiting for postgres at postgresql.pri:5432
Dec 03 11:04:58 iot2 teslamate[1128]: waiting for postgres at postgresql.pri:5432
Dec 03 11:04:59 iot2 teslamate[1128]: waiting for postgres at postgresql.pri:5432
It doesn't appear to want to get past this step. If I manually restart it, it works fine.
Suspect problem is that the container is starting up before networking/dns is up, and as a result it can't resolve the DNS, but doesn't try again when DNS is up.
Expected Behavior
teslamate should start when everything is up and working.
Steps To Reproduce
No response
Relevant log output
As above.
Screenshots
No response
Additional data
No response
Type of installation
Docker
Version
fork
One of my biggest complaints with docker is the order of startup.... depencies do nothing unless you are doing docker compose up but they do nothing if you restart etc.... Prob should implement health checks which could restart this when issues arrise but I don't have time to do so any time soon :(
I have a new theory here. I think what is happening is something along the following lines:
- I was using DHCP to configure my networking.
- systemd starts services - even though
After=network-online.targetis specified before DHCP has established the address. (wonder if there is something I should be doing in systemd to control this). - This means services start before
/etc/resolv.confis configured correctly. - As docker uses
/etc/resolv.conffrom the host, this means the docker container starts without the correct/etc/resolv.conf. - DHCP gets the IP address, configures
/etc/resolv.confbut is too late for the Docker container, which is already running.
I thought I checked the /etc/resolv.conf in the docker container previously, but now I wonder if I did something stupid instead.
In any case, I replaced the DHCP config with static network config, and teslamate starts up correctly on boot.
If others agree, probably OK to close this. Although if I am correct, it could affect other people also.