docker 安装教程

编写:docker_intall.sh,并执行:/bin/sh docker_intall.sh(其中 -y 参数表示自动选 yes)

sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
sudo yum update -y
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -y
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
sudo yum clean all -y
sudo yum makecache -y
sudo yum install docker-ce docker-ce-cli containerd.io -y
sudo systemctl start docker
sudo systemctl enable docker

具体含义是:

# 移除旧的版本
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
 
 
# 升级所有 linux 组件
sudo yum update
# 安装依赖包
sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
 
# 添加源,使用了阿里云镜像
sudo yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
 
# 解决问题:Package: docker-ce-rootless-extras-20.10.2-3.el7.x86_64 (docker-ce-stable)
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
 
 
# 一定要 clean 一下
sudo yum clean all
sudo yum makecache
 
# 安装 docker 并设置开机启动
sudo yum install docker-ce docker-ce-cli containerd.io
 
# 启动 docker
sudo systemctl start docker
sudo systemctl enable docker

参考:
https://zhuanlan.zhihu.com/p/54147784
https://docs.docker.com/engine/install/centos/

上一篇:关于安装git bash和anaconda后运行不了python文件的bug


下一篇:java使用session的验证码