Docker normal installation because it is the foreign site, so slow, so a direct connection through domestic installation here.
A, CentOs installation Docker
surroundings:
- CentOs7.5 version
First, install
1) yum update
CentOs get the latest list of software, execute the command:
[root@jinchengll ~]# yum update
# 提示 Is this ok [y/d/N]: 的时候,输入y回车
2) remove the old version docker
Whether there had not previously installed docker, it's always safest to delete, execute the command:
[root@jinchengll ~]# yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
# 输出如下
已加载插件:fastestmirror
参数 docker 没有匹配
参数 docker-client 没有匹配
参数 docker-client-latest 没有匹配
参数 docker-common 没有匹配
参数 docker-latest 没有匹配
参数 docker-latest-logrotate 没有匹配
参数 docker-logrotate 没有匹配
参数 docker-selinux 没有匹配
参数 docker-engine-selinux 没有匹配
参数 docker-engine 没有匹配
不删除任何软件包
3) install the required dependencies
Installation docker run the required dependencies, execute the command:
[root@jinchengll ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
4) Set yum source image aliyun
To speed up the download speed, the yum source to domestic Ali cloud images, execute the command:
[root@jinchengll ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# 输入如下:
已加载插件:fastestmirror
adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
5) Installation Docker
Preparatory work is complete, begin the installation docker, execute the command:
[root@jinchengll ~]# yum install docker-ce
# 停顿提示的时候都输入y回车
6) the installation is successful
-
Step following results were obtained on the implementation of:
已安装: docker-ce.x86_64 3:19.03.8-3.el7 作为依赖被安装: audit-libs-python.x86_64 0:2.8.5-4.el7 checkpolicy.x86_64 0:2.5-8.el7 container-selinux.noarch 2:2.107-3.el7 containerd.io.x86_64 0:1.2.13-3.1.el7 docker-ce-cli.x86_64 1:19.03.8-3.el7 libcgroup.x86_64 0:0.41-21.el7 libsemanage-python.x86_64 0:2.5-14.el7 policycoreutils-python.x86_64 0:2.5-33.el7 python-IPy.noarch 0:0.75-6.el7 setools-libs.x86_64 0:3.3.8-4.el7 完毕!
-
Run View docker version:
[root@jinchengll ~]# docker -v Docker version 19.03.8, build afacb8b
Here Docker installation is complete! ! !
Two, Docker start, stop
1) Start of docker
-
Execute the following command:
[root@jinchengll ~]# systemctl start docker
-
Use ps to see if started successfully:
[root@jinchengll ~]# ps -ef | grep docker root 10905 1 1 22:26 ? 00:00:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock root 11075 1535 0 22:26 pts/0 00:00:00 grep --color=auto docker
2) docker stop
-
Execute the following command:
[root@jinchengll ~]# systemctl stop docker
-
Use ps to see if closed successfully:
[root@jinchengll ~]# ps -ef | grep docker root 11086 1535 0 22:28 pts/0 00:00:00 grep --color=auto docker
3) docker restart
-
Execute the following command:
[root@jinchengll ~]# systemctl restart docker
4) Check the information docker
When docker already start to see the information, use the following command:
[root@jinchengll ~]# docker info
Third, the change docker mirror for domestic source
Domestic sometimes have difficulty pulling from DockerHub mirror, you can configure mirroring accelerator. Docker official and domestic many cloud service providers offer domestic services accelerators, such as:
- China's official image library Docker: https://registry.docker-cn.com
- Seven cattle Cloud Accelerator: https://reg-mirror.qiniu.com
-
Write the following in /etc/docker/daemon.json (if the file does not exist, please create a new file):
{"registry-mirrors":["https://registry.docker-cn.com"]}
# 我的是不存在,所以直接创建 [root@jinchengll ~]# vim /etc/docker/daemon.json # 写入{"registry-mirrors":["https://registry.docker-cn.com"]} # wq 保存
-
Load the configuration file and restart docker, execute the command:
# 载入配置 [root@jinchengll ~]# systemctl daemon-reload # 重启docker [root@jinchengll ~]# systemctl restart docker
-
To see if successful, execute the command to view the docker information:
[root@jinchengll ~]# docker info # 看到如下内容就可以了 Registry Mirrors: https://registry.docker-cn.com/