Docker Community Forums

Share and learn in the Docker community.

What to do when all docker commands hang?

docker

(Rob) #1

Steps to reproduce the behavior

Running Docker 1.12.6

  1. Run a docker build on an EC2 instance (let’s say the docker build hangs)
  2. Reboot EC2 instance

After the instance reboots, whenever I try to run ANY docker command (e.g., docker info), it just hangs and doesn’t return.

I tried to restart docker, but same problem. I tried to uninstall docker (yum remove docker) and remove /var/lib/docker and reinstall, but even then it still hangs. I have to delete the EC2 instance and start all over again. How do I fix this?


When run every docker command AWS instance networking dies instantly?
(Michael Friis) #2

Can you please open an issue with as many details on the system and on how to reproduce on the Docker repo?


(Nathan Le Claire) #3

A better place for a Docker for AWS issue is probably https://github.com/docker/for-aws

Please make sure to include docker-diagnose output

Thanks!


(Sam A) #4

Please follow the below steps to solve this issue

Step 1 : Uninstall docker “sudo yum remove docker"
Step 2 : remove all docker folder
"sudo rm -rf /var/lib/docker”
“sudo rm -rf /var/run/docker”
“sudo rm /var/run/docker.*” (remove docker.sock, docker.pid files)

Step 3 : Reinstall docker "sudo yum install docker"
Step 4 : Start docker “sudo service docker start”


(Korayhk) #5

You don’t need to reinstall or delete the container image data. Simply do below :slight_smile: slight_smile:

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.


(Tmcconechy) #6

What would you suggest if

sudo service docker stop

Hangs? Can i go ahead delete those files? And is everything self there to remove?


(Korayhk) #7

If service command hangs than you should kill the PID and delete the files.
After you can try to restart using service command.


(Xerus2000) #8

I KILLED docker via the system monitor, and removed said files, but sudo service docker start produces absolutely not output and the problem persists


(Struxdocker) #9

This worked for me. Thanks