Updating to Docker CE

Use this procedure to update Docker to Docker Community Edition (Docker CE) version 17.03.1.
  1. Log in as root, or as a user with superuser privileges.
  2. Remove the Docker repository description file.
    Docker CE uses a different file.
    rm -f /etc/yum.repos.d/docker.repo
  3. Update the Linux kernel, if necessary.
    1. Determine which kernel version is installed.
      uname -r
      If the result is lower than 3.10.0-327.22.2.el7.x86_64, perform the following substeps.
    2. Disable automatic start of serviced.
      systemctl disable serviced
    3. Update the kernel, and then restart the host.
      The following commands require internet access or a local mirror of operating system packages.
      yum makecache fast && yum update -y kernel && reboot
    4. Log in as root, or as a user with superuser privileges.
    5. Enable automatic start of serviced.
      systemctl enable serviced
  4. Install the Docker CE repository description file.
    cat <<EOF > /etc/yum.repos.d/docker-ce.repo
    [docker-ce-stable]
    name=Docker CE Stable - \$basearch
    baseurl=https://download.docker.com/linux/centos/7/\$basearch/stable
    enabled=1
    gpgcheck=1
    gpgkey=https://download.docker.com/linux/centos/gpg
    EOF
  5. Identify the name of the LVM thin pool for Docker.
    docker info 2>/dev/null | grep 'Pool Name'
    Example result:
     Pool Name: docker-docker--pool

    Record the name for use in a subsequent step.

  6. Back up the Docker environment file.
    test -f /etc/sysconfig/docker \
      && mv /etc/sysconfig/docker /etc/sysconfig/docker.bak
  7. Stop the Docker service.
    systemctl stop docker
  8. Remove Docker 1.9.0 without checking dependencies.
    rpm -e --nodeps docker-engine-1.9.0
  9. Install Docker CE 17.03.1.
    With internet access:
    yum clean all && yum makecache fast
    yum install -y --setopt=obsoletes=0 \
      docker-ce-17.03.1.ce-1.el7.centos \
      docker-ce-selinux-17.03.1.ce-1.el7.centos
    Without internet access:
    yum install -y --disablerepo=\* --enablerepo=zenoss-mirror \
      docker-ce-17.03.1.ce
  10. Disable unintended Docker CE updates.
    1. Open /etc/yum.repos.d/docker-ce.repo with a text editor.
    2. Change the value of the enabled key from 1 to 0.
    3. Save the file, and then close the text editor.