-
Official Chinese document: docs.docker-cn.com/engine/inst…
-
Make sure you are CentOS7 or later: cat /etc/redhat-release
-
Yum install GCC
- Install GCC: yum -y install GCC
- Yum -y install gcc-C ++
- Verify the successful installation: GCC -v
-
Uninstall the old version: yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
-
Lvm2: yum install -y yum-utils device-mapper-persistent-data lvm2
-
Set stable mirror warehouse:
- Website method: yum – config manager – add – repo download.docker.com/linux/cento…
- (recommended) ali cloud: yum – config – manager – add – repo mirrors.aliyun.com/docker-ce/l…
- Suggestion: use ali cloud method, because the official website is very slow, easy to report errors
-
Update yum Package index: yum makecache Fast
-
Yum -y install Docker CE
-
Start docker: systemctl start docker
-
Testing:
- Version: Docker version
- Hello-world: docker run hello-world
-
Configuring mirror acceleration:
- mkdir -p /etc/docker
- vim /etc/docker/daemon.json
- # registry {“registry “: [“https:// {mirror.aliyuncs.com”]} # registry {“registry “: [“https:// {own code}.mirror.aliyuncs.com”]}
- systemctl daemon-reload
- systemctl restart docker
-
Uninstall:
- systemctl stop docker
- yum -y remove docker-ce
- rm -rf /var/lib/docker