Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker commands hanging with no response

Docker daemon is running fine, but docker just hangs indefinitely with no output when I do docker images, docker ps and so on. This wasn't happening last night and it's driving me nuts.

I reinstalled docker on my AWS Linux AMI with no luck. I have also tried sudo service docker restart and that didn't yield a fix. If anyone has run into this or has any suggestions please share.

Instance Info:

NAME="Amazon Linux AMI"
VERSION="2016.09"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2016.09"
PRETTY_NAME="Amazon Linux AMI 2016.09"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2016.09:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
Amazon Linux AMI release 2016.09

Docker version:

Docker version 1.11.2, build b9f10c9/1.11.2

Thank you in advance!

like image 619
Mihado Avatar asked Jan 06 '17 15:01

Mihado


People also ask

Why does the Docker command hang?

The docker command uses the Docker API. The Docker client can communicate with more than one daemon. When your docker command hangs unexpectedly, there maybe such problems in your system: Your computer is full of docker images, has exceeded the capacity of your computer.

What to do if Docker failed to start containers?

Error: failed to start containers: Try running docker start command again. You will have your container up and running magically without any errors. 4 Likes All docker command line commands hang

Does Docker help still work?

However, docker help and docker version still work. I think there is something like a deadlock with a particular container, so commands related to containers won't complete. How to handle such a situation ?

What is the context of a dockerfile?

When you run the docker build command, the Docker client will send the “context” of your Dockerfile via REST to the Docker daemon. This “context” is the content of what is in the directory of where you created the Dockerfile. In other words, Docker client is scanning all files and folders.


2 Answers

I know this question is a bit old, but to fix this, try deleting the contents of:

/var/run/docker/libcontainerd
like image 169
Garreth McDaid Avatar answered Oct 05 '22 17:10

Garreth McDaid


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.

like image 34
Dom J Avatar answered Oct 05 '22 15:10

Dom J