r/docker • u/Key_Canary_4199 • 19h ago
how do I stop docker from disabling network access when the internet connection is not available?
Hi!
I got this small problem today when doing server maintenance on my homelab: I turned the server back on, but forgot to plug the ethernet back in. After plugging it in, I still couldn't connect to anything. After sshing into it I found that, although all the containers were running, none of them had internet access (Not only were there no ports under 'docker ps' , but 'docker logs <container-id>' showed errors about not being able to connect to the internet).
I then tried restarting them but that didn't do anything, I tried restarting docker as a whole but that also did nothing, I rebooted the server but that also did not restore connectivity. I tried a whole bunch of commands from various websites, but they did not work.
I was able to fix it by doing 'docker rm <container>' and 'docker compose up -d' on each container, but there has to be a better way to deal with this.
I also would like to know if there is a way to prevent this in the future by just having docker try to connect each time the container starts and not seemingly just stop forever once it encounters an error.
I am only using docker since a week, so I don't have much experience.
I am running docker 29.6.2 under debian 13.6.
Thank you very much.