search by tags

for the user

adventures into the land of the command line

docker, aufs and ubuntu prob-lamos

Let’s say you’re using Ubuntu-14.04 for whatever reason, and you run this command:

$ docker-machine create --driver generic --generic-ip-address= --generic-ssh-key /root/.ssh/id_rsa --generic-ssh-user root mylocalmachine
Running pre-create checks...
Creating machine...
(mylocalmachine) Importing SSH key...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with ubuntu(upstart)... read: connection reset by peer
You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
Be advised that this will trigger a Docker daemon restart which might stop running containers.

** So docker-machine installs/updates the docker daemon and changes the defaults to use the aufs storage driver.

$ cat /etc/default/docker

-H tcp://
-H unix:///var/run/docker.sock
--storage-driver aufs
--tlscacert /etc/docker/ca.pem
--tlscert /etc/docker/server.pem
--tlskey /etc/docker/server-key.pem
--label provider=generic


aufs is not properly supported on ubuntu. When this is set, and docker daemon is restarted, docker will start like this:

/usr/bin/dockerd -H tcp:// -H unix:///var/run/docker.sock --storage-driver aufs --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=generic --raw-logs

… and running docker ps or any other docker command will give:

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

… this value needs to be set to “devicemapper” in /etc/defaults/docker so the docker daemon is running with:

/usr/bin/dockerd -H tcp:// -H unix:///var/run/docker.sock --storage-driver devicemapper --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=generic --raw-logs

… then:

$ docker-machine ls
NAME             ACTIVE   DRIVER    STATE     URL                    SWARM   DOCKER        ERRORS
mylocalmachine   -        generic   Running   tcp://           v17.06.0-ce

…to actually avoid this whole problem in the first place, its recommended to install some extra packages BEFORE installing docker on the system, so devicemapper will not be used:

sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual