共计 1371 个字符,预计需要花费 4 分钟才能阅读完成。
确认学习环境 (Centos 7)
cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
帮忙文档
https://docs.docker.com/engin…
1. 删除旧版本
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2. 须要的安装包
sudo yum install -y yum-utils
3. 设置镜像仓库(阿里云)
yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
阿里云镜像减速
https://help.aliyun.com/docum…
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{"registry-mirrors": ["https://***.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
4. 更新 yum 索引
yum makecache fast
5. 装置 Docker(docker-ce 社区 docker-ee 企业)
sudo yum install docker-ce docker-ce-cli containerd.io
6. 启动 docker
systemctl start docker
7. 查看版本
docker version
8. 运行 hello world
sudo docker run hello-world
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest d1165f221234 4 months ago 13.3kB
9. 卸载 Docker
#1. 卸载依赖
sudo yum remove docker-ce docker-ce-cli containerd.io
#2. 删除资源
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
教程地址
【狂神说 Java】Docker 最新超具体版教程通俗易懂
正文完