docker(centos7)純命令安裝貼
阿新 • • 發佈:2018-11-07
1. 安裝依賴包
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
2. 配置映象源(使用中科大映象站)
切換到repo目錄:
cd /etc/yum.repo.d/
新增證書:
wget http://mirrors.ustc.edu.cn/docker-ce/linux/centos/gpg
rpm --import gpg
下載docker-repo:
wget http://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
替換官方地址(編輯模式):
vim docker-ce.repo
% s:download.docker.com:mirrors.ustc.edu.cn\/docker-ce:g
3. 更新快取,安裝docker
yum makecache
yum install docker-ce -y
4. 設定開機啟動
systemctl enable docker
systemctl start docker
5.配置docker映象加速器(可以申請阿里雲的專屬加速器,位置:容器映象服務)
vim /etc/docker/daemon.json
{
"https://registry.docker-cn.com"
]
}
systemctl daemon-reload
systemctl restart docker
6.開啟你的hello-world!
docker run hello-world
6.基本完成,主要目的是記錄,方便貼上複製。下一步計劃做一個指令碼,坐等更新。