1、配置yum源,安裝dockerlinux
[root@docker yum.repos.d]# pwd /etc/yum.repos.d [root@docker yum.repos.d]# wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo [root@docker yum.repos.d]# cd [root@docker ~]# yum makecache [root@docker ~]# yum repolist ..................................... docker-ce-stable/x86_64 Docker CE Stable - x86_64 79 #確認docker.....這一列有可用的包,我這裏顯示的是79個(多點少點不要緊,但必定要有這一列,而且不能爲0) [root@docker ~]# yum install -y docker-ce-18.09.0-3.el7 docker-ce-cli-18.09.0-3.el7 containerd.io-1.2.0-3.el7 # yum安裝docker
若centos是最小化安裝,則須要執行如下命令,以便支持Docker命令自動補全github
[root@docker1 ~]# yum -y install bash-completion [root@docker1~]# curl -L https://raw.githubusercontent.com/docker/compose/1.24.1/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose [root@docker1 ~]# source /etc/bash_completion.d/docker-compose
2、啓用下載鏡像的加速功能
接下來啓用道雲提供的下載鏡像加速功能
道雲加速器網址docker
流程以下:
(1)訪問道雲的官網;
(2)註冊用戶而且登陸;json
看到以下界面後往下翻
centos
[root@docker ~]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io docker version >= 1.12 {"registry-mirrors": ["http://f1361db2.m.daocloud.io"]} Success. You need to restart docker to take effect: sudo systemctl restart docker [root@docker ~]# systemctl daemon-reload [root@docker ~]# systemctl restart docker [root@docker ~]# systemctl enable docker [root@docker ~]# cat /etc/docker/daemon.json # 這個就是加速器相關的文件 {"registry-mirrors": ["http://f1361db2.m.daocloud.io"]} [root@docker ~]# docker -v Docker version 18.09.0, build 4d60db4