Docker commands hanging with no response
https://forums.docker.com/t/what-to-do-when-all-docker-commands-hang/28103/4 By korayhk:
You don’t need to reinstall or delete the container image data. Simply do below :
Stop the service first
sudo service docker stop
Clean up some of the files as mentioned in above post from Sam.
sudo rm -rf /var/run/docker
sudo rm /var/run/docker.*"
Start service now
sudo service docker start
Start your docker image
docker start <container-name>
You will receive an error when you run the docker run at first try:
Error response from daemon: invalid header field value "oci runtime error: container with id exists: 7a244b8f5d07081538042ff64aebfe11fac1a36731526e77be53db7d94dca44d\n" Error: failed to start containers:
Try running docker start command again. You will have your container up and running magically without any errors.
After updating my ubuntu to 5.8.0-34-generic. I had similar issue. after various attempts to resolve it, My final solution was to downgrade docker to the previous working version. Steps as below:
- Kill docker
root@LT01:~# killall dockerd root@LT01:~# ps -aux | grep dockerd root@LT01:~# kill -9 your docker pid
- Remove docker ce, cli and container.io
root@LT01:/home/xyz# apt remove docker-ce docker-ce-cli containerd.io
- optional step: my dockerd was constantly restarting so I had to disable ir. If you do the same. you'll need to enable it after new installation:
systemctl disable docker
- check previous versions:
root@LT01:/home/xyz# apt-cache madison docker-ce
- install older version from the above list, in my case, docker-ce 5:19.03.13~3-0~ubuntu-focal:
root@LT01:/home/xyz# apt install docker-ce=5:19.03.13~3-0~ubuntu-focal
- optional: if you need downgrade containerd.io and cli as well then:
apt install docker-ce=5:19.03.13~3-0~ubuntu-focal containerd.io=1.3.9-1 docker-ce-cli=5:19.03.13~3-0~ubuntu-focal
- check your installation:
whereis docker systemctl status docker
Also, marked my docker to not upgrade on apt upgrade command.
I tried both of the answers by Garreth and steamfood, but didn't want to reinstall docker as Invincible suggested. I hadn't changed anything on my system so figured the problem had to be with my configuration/container setup rather than an installation problem with docker itself.
When running systemctl start docker
or anything else to start or stop the docker service, I was getting this in my logs (running systemctl status docker
in another terminal):
Loading containers: start.
Container ef06fbb157169332c453f503bb2543ce914daf54600f8fa44699fa5833d9eb90 failed to exit
It would hang after this point.
To fix this, I first killed the process identified in systemctl status docker
with sudo kill -9 $PID
.
I then deleted everything in /var/lib/docker/containers
with sudo rm -rf /var/lib/docker/containers/*
.
This cleared out the problematic container and everything worked from then on.
I know this question is a bit old, but to fix this, try deleting the contents of:
/var/run/docker/libcontainerd