Failure to start docker on an Amazon linux machine

Hi, I am using an Amazon linux machine (p2).

I have installed this docker version:

Client:
Version: 17.03.2-ce
API version: 1.27
Go version: go1.7.5
Git commit: 7392c3b/17.03.2-ce
Built: Wed Aug 9 22:45:09 2017
OS/Arch: linux/amd64

I’m not sure, but I think the issue started after killing a screen which ran some docker container

I’m experiencing this error:

sudo docker ps

Gives:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

And:

sudo service docker status

Gives:

docker dead but subsys locked
I have tried both:

sudo rm -rf /var/run/docker
sudo rm /var/run/docker.*

how about

sudo service docker stop
sudo service docker start
2 Likes

It’s stuck after trying:
sudo service docker stop

you will probably have to reboot the ec2 instance

I rebooted the mahcine

and the docker ps returns the same error?

if so, then sudo service docker start

sudo docker ps gives the same error.
sudo service docker start works (but does not print anything)

and then docker ps ??

service start command doesn’t usually show anything (for me)

docker ps gives (sudo service docker start)
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

ok, looks like some known error

use the docker-machine command…

I don’t see how this helps. I’m using nvidia-docker

no idea… you didn’t mention nvidia docker…

Let us wait for more helpful responses. Thank you

may be useful

It’s a general link which is not relevant.

Try:

  1. Check the status:
    $ sudo service docker status
  2. If there isn’t running:
    $ sudo service docker start
  3. And then to auto-start after reboot:
    $ sudo systemctl enable docker
  4. Don’t forget to add your ec2-user to the docker group:
    $ sudo usermod -aG docker ec2-user
  5. And then reboot or just logoff/login again
    $ sudo reboot

bye

2 Likes

This worked for like a charm.
After starting services, i am to run all docker commands.
-Vinod

Still works like a charm 3+ years on :slight_smile: