Installing Docker on Amazon AMI Quick Fix

I was installing and playing with Docker on an AWS EC2 instance this evening, using the default amazon AMI [specifically Amazon Linux AMI 2015.09.1 (HVM)] and came across a stupidly simple issue.

Docker containers would not start and were showing the following error:

Cannot connect to the Docker daemon. Is 'docker -d' running on this host?


Checking processes I don’t see docker running:

$ ps -ef | grep docker
ec2-user  2518  2485  0 22:20 pts/0    00:00:00 grep --color=auto docker


After looking at a similar issue I had with Ubuntu a year or so ago, I realised (duh!) the Docker service was simply not running, even though it had installed fine.

A quick start of the service fixed this:

$ sudo service docker start


And now…

$ ps -ef | grep docker
root      7119     1  1 22:30 pts/0    00:00:07 /usr/bin/docker daemon --default-ulimit nofile=1024:4096
ec2-user  7539  2429  0 22:41 pts/0    00:00:00 grep --color=auto docker
$ sudo docker info
Containers: 1
Images: 4
Server Version: 1.9.1
Storage Driver: devicemapper
 Pool Name: docker-202:1-263816-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 107.4 GB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 291.9 MB
 Data Space Total: 107.4 GB
 Data Space Available: 6.695 GB
 Metadata Space Used: 892.9 kB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.147 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.93-RHEL7 (2015-01-28)
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.1.10-17.31.amzn1.x86_64
Operating System: Amazon Linux AMI 2015.09
CPUs: 1
Total Memory: 995.6 MiB

 

This has now continued to work fine through reboots, so hopefuly saves someone spending more than a few seconds troubleshooting!

AWS, Docker , , , ,