Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade docker on CentOS 7

I'm running centos 7 and have installed docker on host using epel packages:

yum install epel-release yum install docker 

But the docker version is-Docker version 0.11.1-dev, build 02d20af/0.11.1

The latest stable branch of docker is 1.2

I'm running couple of containers on this host, so how can i update docker safely on this host?

yum update docker does not update to the latest version as the epel repo has old package.

like image 941
nmd Avatar asked Oct 20 '14 18:10

nmd


People also ask

How do I upgrade Docker to latest version?

To upgrade Docker Engine, first run sudo apt-get update , then follow the installation instructions, choosing the new version you want to install.

Does CentOS 7 support Docker?

OS requirementsTo install Docker Engine, you need a maintained version of CentOS 7, CentOS 8 (stream), or CentOS 9 (stream). Archived versions aren't supported or tested. The centos-extras repository must be enabled. This repository is enabled by default, but if you have disabled it, you need to re-enable it.

What is the latest version of Docker for Linux?

The most recent Docker release, however, is 20.10. 7 (released June 6, 2021).


2 Answers

Note that current stable version of Docker is actually 1.3, not 1.2. See the Docker CHANGELOG to discover the latest version.

Before upgrading your docker host, you might want to backup some of the docker images you have, especially those issued from the docker commit command. To do so, take a look at the docker export command. You might also want to backup your containers' volumes. For that take a look at the Docker user guide on data volumes.

Once you are confident you have all the backups you need for an eventual fresh start you can move on upgrading your Docker daemon.

On the Docker installation guide for CentOS 7, it is advised to install docker from the binaries if you want the latest. I suggest you follow those instructions to install the latest docker. Docker now provides updates through the yum package manager.

Once done with that use the docker images command to verify if you still have your Docker images and docker ps to check your containers. If some are missing, recreate them from your backups.

If you created docker images from custom Dockerfiles, you also want to rebuild those images to check that no Dockerfile has issues with the new Docker daemon. There is a big gap between Docker 0.11.1 and 1.3 and fixes and new features were brought to the Dockerfiles syntax.


In details here are the commands to run once you are ready to upgrade docker:

# stop the docker service $ sudo service docker stop  # download the latest docker binary and replace the current outdated docker # DEPRECATED WAY TO UPGRADE DOCKER: $ sudo wget https://get.docker.com/builds/Linux/x86_64/docker-latest -O /usr/bin/docker $ sudo yum update docker-engine  # start the docker service $ sudo service docker start  # check the version $ sudo docker version  # check the images and containers $ sudo docker images $ sudo docker ps $ sudo docker ps -a 
like image 71
Thomasleveil Avatar answered Sep 20 '22 16:09

Thomasleveil


Update to upgrade docker CentOS 7.4

sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux  docker-engine-selinux docker-engine sudo yum install -y yum-utils device-mapper-persistent-data lvm2 sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo sudo yum install docker-ce   sudo systemctl start docker sudo systemctl enable docker sudo systemctl status docker 

Refer:

https://docs.docker.com/install/linux/docker-ce/centos/

like image 26
rmsys Avatar answered Sep 18 '22 16:09

rmsys