If you’ve a CentOS 7 server, you probably picked at first Docker from a specialized CBS from Project Atomic, “virt7”, or from EPEL.
It’s been a while Docker 1.13 has been released. Yet, there isn’t any upgrade beyond 1.12 (but fixes backported to this 1.12 branch).
You need to get rid of the old packages, then install a specific repository (community docker-ce or your subscription docker-ee one) and a new docker-ce/docker-ee package. The procedure is described at https://docs.docker.com/engine/installation/linux/centos/. A Salt state for that is provided below.
During this upgrade, your containers will be still running, the Docker engine now being able to pick up resources already launched and containerized and manage them.
Upgrade from an old Docker version prior to 1.10
The image data format has been changed.
Anytime it’s convenient, destroy and recreate every containers. For the few containers you can’t, use the migration tool to minimize downtime. If you don’t, this upgrade will be done automatically at container start time, and it will take a while.
Runtime error
If you left a Project Atomic installation, you’ve currently docker-runc
as engine name. But for recent versions of Docker, the engine is simply runc
.
You so need to replace it in hostconfig.json files.
From a Docker host with GNU sed available, you can do an inline replace:
1 2 3 4 |
cd /var/lib/docker/containers for i in */hostconfig.json do sed -i 's/docker-runc/runc/g' $i done |
This fixes the following error:
docker-runc not installed on system
Salt state
If you use SaltStack, you can use the following state.
This state directly downloads the docker-ce.repo file from the repository, to avoid to translate it in Salt pkgrepo states.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# ------------------------------------------------------------- # Install Docker engine # ------------------------------------------------------------- {% if grains['os'] == 'CentOS' %} remove_legacy_docker_packages: pkg: - removed - pkgs: - docker-common - container-selinux - docker-selinux - docker-engine install_docker_engine: file.managed: - name: /etc/yum.repos.d/docker-ce.repo - source: https://download.docker.com/linux/centos/docker-ce.repo - source_hash: 257562ba65fb37d13ad0a449c21ebdd43aeb8963ca267133e6eb57ca8c89611e pkg: - installed - pkgs: - device-mapper-persistent-data - lvm2 - docker-ce {% endif %} |