{"id":670,"date":"2017-05-24T13:26:56","date_gmt":"2017-05-24T11:26:56","guid":{"rendered":"https:\/\/www.dereckson.be\/blog\/?p=670"},"modified":"2017-05-24T13:33:11","modified_gmt":"2017-05-24T11:33:11","slug":"upgrade-beyond-docker-1-12-on-centos-7","status":"publish","type":"post","link":"https:\/\/www.dereckson.be\/blog\/2017\/05\/24\/upgrade-beyond-docker-1-12-on-centos-7\/","title":{"rendered":"Upgrade beyond Docker 1.12 on CentOS 7"},"content":{"rendered":"<p>If you&#8217;ve a CentOS 7 server, you probably picked at first Docker from a specialized CBS from Project Atomic, &#8220;virt7&#8221;, or from EPEL.<\/p>\n<p>It&#8217;s been a while Docker 1.13 has been released. Yet, there isn&#8217;t any upgrade beyond 1.12 (but fixes backported to this 1.12 branch).<\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<h2>Upgrade from an old Docker version prior to 1.10<\/h2>\n<p>The image data format has been changed.<\/p>\n<p>Anytime\u00a0it&#8217;s convenient,\u00a0destroy and recreate every containers. For the few containers you can&#8217;t, use <a href=\"https:\/\/docs.docker.com\/engine\/migration\/\">the migration tool <\/a>to minimize downtime. If you don&#8217;t, this upgrade will be done automatically at container start time, and it will take a while.<\/p>\n<h2>Runtime error<\/h2>\n<p>If you left a Project Atomic installation, you&#8217;ve currently <code>docker-runc<\/code> as engine name. But for recent versions of Docker, the engine is simply <code>runc<\/code>.<\/p>\n<p>You so need to replace it in hostconfig.json files.<\/p>\n<p>From a Docker host with GNU sed available, you can do an inline replace: <\/p>\n<pre class=\"lang:sh decode:true \" title=\"Fix runtime\" >cd \/var\/lib\/docker\/containers\r\nfor i in *\/hostconfig.json\r\n    do sed -i 's\/docker-runc\/runc\/g' $i\r\ndone<\/pre>\n<p>This fixes the following error:<\/p>\n<p><code>docker-runc not installed on system<\/code><\/p>\n<h2>Salt state<\/h2>\n<p>If you use SaltStack, you can use the following state.<\/p>\n<p>This state directly downloads the docker-ce.repo file from the repository, to avoid to translate it in Salt pkgrepo states.<\/p>\n<pre class=\"lang:yaml decode:true \" title=\"Salt state to install Docker CE on CentOS 7\" >\r\n#   -------------------------------------------------------------\r\n#   Install Docker engine\r\n#   -------------------------------------------------------------\r\n\r\n{% if grains['os'] == 'CentOS' %}\r\nremove_legacy_docker_packages:\r\n  pkg:\r\n    - removed\r\n    - pkgs:\r\n      - docker-common\r\n      - container-selinux\r\n      - docker-selinux\r\n      - docker-engine\r\n\r\ninstall_docker_engine:\r\n  file.managed:\r\n    - name: \/etc\/yum.repos.d\/docker-ce.repo\r\n    - source: https:\/\/download.docker.com\/linux\/centos\/docker-ce.repo\r\n    - source_hash: 257562ba65fb37d13ad0a449c21ebdd43aeb8963ca267133e6eb57ca8c89611e\r\n  pkg:\r\n    - installed\r\n    - pkgs:\r\n      - device-mapper-persistent-data\r\n      - lvm2\r\n      - docker-ce  \r\n{% endif %}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;ve a CentOS 7 server, you probably picked at first Docker from a specialized CBS from Project Atomic, &#8220;virt7&#8221;, or from EPEL. It&#8217;s been a while Docker 1.13 has been released. Yet, there isn&#8217;t any upgrade beyond 1.12 (but fixes backported to this 1.12 branch). You need to get rid of the old packages, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[45],"tags":[],"class_list":["post-670","post","type-post","status-publish","format-standard","hentry","category-misc"],"_links":{"self":[{"href":"https:\/\/www.dereckson.be\/blog\/wp-json\/wp\/v2\/posts\/670","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dereckson.be\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dereckson.be\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dereckson.be\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dereckson.be\/blog\/wp-json\/wp\/v2\/comments?post=670"}],"version-history":[{"count":3,"href":"https:\/\/www.dereckson.be\/blog\/wp-json\/wp\/v2\/posts\/670\/revisions"}],"predecessor-version":[{"id":757,"href":"https:\/\/www.dereckson.be\/blog\/wp-json\/wp\/v2\/posts\/670\/revisions\/757"}],"wp:attachment":[{"href":"https:\/\/www.dereckson.be\/blog\/wp-json\/wp\/v2\/media?parent=670"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dereckson.be\/blog\/wp-json\/wp\/v2\/categories?post=670"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dereckson.be\/blog\/wp-json\/wp\/v2\/tags?post=670"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}