Docker entry to actual combat (2) installation and uninstall of docker

Time:2021-4-10

This article is from Mr. Zhou Yang https://www.bilibili.com/vide…

Introduction to docker

2: Docker installation and uninstall

2.1 installation environment description

Docker is officially recommended to be installed in Ubuntu, because docker is released based on Ubuntu, and generally, problems with docker are first updated or patched in Ubuntu. But companies generally use CentOS, so this installation is above CentOS 7

2.2 start installation

Refer to the installation steps of the official website https://docs.docker.com/insta…

2.2.1 view CentOS version

cat /etc/redhat-release

Docker entry to actual combat (2) installation and uninstall of docker

2.2.2 installing GCC
yum -y install gcc

Docker entry to actual combat (2) installation and uninstall of docker

yum -y install gcc c++

Docker entry to actual combat (2) installation and uninstall of docker

2.2.3 (if installed) uninstall the old version of docker
yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine

Docker entry to actual combat (2) installation and uninstall of docker

2.2.4 software package required for installation
yum install -y yum-utils device-mapper-persistent-data lvm2

Docker entry to actual combat (2) installation and uninstall of docker

2.2.5 it is faster to set up stable image warehouse to use domestic Alibaba cloud
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

Docker entry to actual combat (2) installation and uninstall of docker

2.2.6 update Yum package index
yum makecache fast

Docker entry to actual combat (2) installation and uninstall of docker

2.2.7 installing docker CE
 yum -y install docker-ce

Docker entry to actual combat (2) installation and uninstall of docker

2.2.8 start docker and test
systemctl start docker

docker version

Docker entry to actual combat (2) installation and uninstall of docker

2.2.9 hello-world
docker run hello-world

Docker entry to actual combat (2) installation and uninstall of docker

2.3 setting the startup time

Set boot time
systemctl enable docker.service
Turn off power on
systemctl disable docker.service

Docker entry to actual combat (2) installation and uninstall of docker

2.4 uninstall docker

systemctl stop docker 
yum -y remove docker-ce
rm -rf /var/lib/docker

Next:

Introduction to docker and actual combat (3) common commands of docker