1. CentOS7安裝Docker
1.1 官方英文安裝參考手冊(cè)
https://docs.docker.com/install/linux/docker-ce/centos/
1.2 安裝步驟
1) 官網(wǎng)中文安裝參考手冊(cè)
2) 確定你是CentOS7及以上版本
cat /etc/redhat-release
3) yum 安裝
1.外網(wǎng)訪問(wèn)
yum -y install gcc
yum -y install gcc-c++
4) 卸載舊版本
yum -y remove docker docker-common docker-selinux docker-engine
2018.3 官網(wǎng)版本
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
5. 安裝需要的軟件包
yum install -y yum-utils device-mapper-persistent-data lvm2
6. 設(shè)置stable鏡像倉(cāng)庫(kù)
推薦
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
不推薦
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
報(bào)錯(cuò):
1 [Errno 14] curl#35 - TCP connection reset by peer2 [Errno 12] curl#35 - Timeout
7. 更新yum軟件包索引
yum makecache fast
8. 安裝DOCKER CE
yum -y install docker-ce
9. 啟動(dòng)docker
systemctl start docker
10. 測(cè)試
docker version
docker run hello-world
11. 配置鏡像加速
mkdir -p /etc/docker
vim /etc/docker/daemon.json
#網(wǎng)易云
{"registry-mirrors": ["http://hub-mirror.c.163.com"] }
#阿里云
{
"registry-mirrors": ["https://{自已的編碼}.mirror.aliyuncs.com"]
}
systemctl daemon-reload
systemctl restart docker
12. 卸載
systemctl stop docker
yum -y remove docker-ce
rm -rf /var/lib/docker
13. 查詢IP
docker inspect mysql | grep IPAddress