After server restart docker looks alive but all commands like docker ps
hang forever until I press Ctrl+C.
What can be wrong?
Docker version 1.12.6, build 7392c3b/1.12.6
Linux ip-10-0-1-124 4.4.10-22.54.amzn1.x86_64
If even one of your containers does not respond to SIGTERM signals, Docker will wait for 10 seconds at least. If your containers depend on each other, docker-compose can't shut them down all at once. It will ask them to stop in the right order, waiting for each one. This waiting time can add up.
docker rm -f The final option for stopping a running container is to use the --force or -f flag in conjunction with the docker rm command. Typically, docker rm is used to remove an already stopped container, but the use of the -f flag will cause it to first issue a SIGKILL.
Docker provides restart policies to control whether your containers start automatically when they exit, or when Docker restarts. Restart policies ensure that linked containers are started in the correct order. Docker recommends that you use restart policies, and avoid using process managers to start containers.
Yes, once your container ceases to exist or you restart it, the data will be lost. But that can be easily fixed if you use persistent volumes to store your data. My preferred solution is to use a container orchestrator like Swarm, Kubernetes, etc. I'll expand on volumes in Kubernetes a little bit.
It turned out instance had uptime for over a year, many application releases were installed, /var/lib/docker/devicemapper
folder contained hundreds of items that apparently refer to older abandoned containers.
I saw the process of eternal reading all this data while dockerd -D
command that runs docker interactively for debugging.
I removed /var/lib/docker
and /var/run/docker
and re-installed docker and containers on my box, the problem was resolved.
Feels like I need a script that would periodically remove obsolete items from docker internals.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With