Docker – How to upgrade Docker (to 1.10.0) on CentOS7

centos7docker

Docker 1.8.2-10.el7.centos was installed and was able to run on CentOS7.

In order to upgrade docker this post was read and the following commands were issued:

  • curl -L https://get.docker.com/builds/Linux/x86_64/docker-latest > /usr/bin/docker; chmod +x /usr/bin/docker
  • curl -L https://raw.githubusercontent.com/docker/docker/master/contrib/init/systemd/docker.service > /usr/lib/systemd/system/docker.service
  • curl -L https://raw.githubusercontent.com/docker/docker/master/contrib/init/systemd/docker.socket > /usr/lib/systemd/system/docker.socket

Problem

When docker is started:

systemctl start docker

it seems to hang and /var/log/messages indicates that:

Feb 11 00:22:01 localhost systemd: Device dev-disk-by\x2duuid-f00f4f0a\x2dba57\x2d468b\x2dba82\x2d72f1bb087bbb.device appeared twice with different sysfs paths /sys/devices/virtual/block/loop0 and /sys/devices/virtual/block/dm-6
Feb 11 00:22:05 localhost docker: time="2016-02-11T00:22:05.977110830+01:00" level=info msg="calculated checksum for layer 26de6fe292b2275378ce421742105813ee98fb49a5e0e45c1fd89e20eedc2c31: sha256:0c42efc496d9944258fb38ccfa64f53c32433a24daa3ad64144e48c5deb1c78c"
Feb 11 00:22:06 localhost kernel: EXT4-fs (dm-8): mounted filesystem with ordered data mode. Opts: (null)
Feb 11 00:22:06 localhost systemd-udevd: conflicting device node '/dev/mapper/docker-253:0-68595821-51009a2811797c49222fd5f9cb9e38fbe4fca9cf2a7fcfb1151d34c0b545a42a' found, link to '/dev/dm-8' will not be created
Feb 11 00:22:06 localhost systemd: Device dev-disk-by\x2duuid-f00f4f0a\x2dba57\x2d468b\x2dba82\x2d72f1bb087bbb.device appeared twice with different sysfs paths /sys/devices/virtual/block/loop0 and /sys/devices/virtual/block/dm-8

Discussion

  1. The strange thing is that the binary has been upgraded:

    [root@localhost]# docker -v
    Docker version 1.10.0, build 590d5108

but the service cannot be started.

  1. Although 1.10.0 cannot start on CentOS7, docker 1.9.0 is able to start: curl -L https://get.docker.com/builds/Linux/x86_64/docker-1.9.0 > /usr/bin/docker; chmod +x /usr/bin/docker

Question

How to upgrade Docker to 1.10.0 on CentOS7?

Best Answer

docker's default storage driver might have changed.

I had the same problem and today I was succeded to start docker 1.10 finally. My problem was the docker's starting command. It seemed that I had used the docker with devicemapper storage driver and docker 1.10 driver was not the same.

Here is what I tried.

1. Delete network files.

When I gave up upgrading docker 1.10 once and downgraded it 1.10 to 1.9, 1.9 wouldn't start. It started after I deleted these files. This may not effect your problem, but I decided that I delete them before upgrade docker from now on.

mkdir /var-lib-docker-network-files  
mv /var/lib/docker/network/files/* /var-lib-docker-network-files

2. Overwrite ExecStart as your customized command.

You can see the default start command in here;

vi /lib/systemd/system/docker.service 

Mine was completely same with the official repository's.

ttps://github.com/docker/docker/blob/master/contrib/init/systemd/docker.service

It should be like this;

ExecStart=/usr/bin/docker daemon -H fd://

This command didn't work for me. So I made a file which overrided the command as a wrapping conf file here;

vi /etc/systemd/system/docker.service.d/docker.conf 

[Service]
ExecStart=
ExecStart=/usr/bin/docker daemon -s devicemapper -H fd://

3. Reload and Start

Make sure to reload systemd before start docker.

systemctl daemon-reload
service docker start

FYI, this command will remove all docker images.

I saw an another ExecStart line at here.

vi /etc/systemd/system/docker.service.d/docker.conf 

[Service]
ExecStart=
ExecStart=docker daemon -D -s overlay

Although this worked and made docker 1.10 started, my all of docker images has disappeared. I was very annoyed due to docker images returned nothing. But I still had a lot of real image files in /var/lib/docker/devicemapper/ so I thought this command reffered a strange directory. Then I got the answer, it's devicemapper.

Official Document

You can see the details here. We might have to learn about the daemon.