Steps to install docker under centos

1. Installation instructions: centos is a more common system with a linux kernel, so installing docker is relatively simple, see the second step.

2. Installation steps:

1. Check the kernel version (docker requires the kernel of the centos system to be higher than 3.10), the command is as follows:

$ uname -r

2. Use the root account to log in to the system, make sure that the yum package is updated to the latest, the command is as follows:

$ sudo yum update

3. Check if docker has been installed, the command is as follows:

docker -v

4. If docker has been installed and the version is judged to be older, it is recommended to uninstall the old version and reinstall docker. The command is as follows:

$ sudo yum remove docker docker-common docker-selinux docker-engine

5. If you need to reinstall a new version of docker, first prepare the docker installation environment, please execute the following command:

$ 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

6. To view all docker versions in the warehouse, the command is as follows:

$ yum list docker-ce --showduplicates | sort -r

7. Install docker, the command is as follows (if no specific version is specified, the latest stable version will be installed, as shown in the first sentence of the command; if you need to install the specified version of docker, please refer to the second sentence of the command):

$ sudo yum install docker-ce
sudo yum install docker-ce-17.12.0.ce

8. Verify that the installation is successful

$ docker version
$ docker -v

9. The installation is successful, start docker, the command is as follows:

$ sudo systemctl start docker

10. Set docker to boot to avoid unnecessary trouble. The command is as follows:

$ sudo systemctl enable docker

11.Stop docker

$ sudo systemctl stop docker

 

Guess you like

Origin blog.csdn.net/joyksk/article/details/111944651