Centos下安装Docker
替换为国内的yum源(可选):
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo
yum makecache
安装所需要的软件包:
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
安装containerd.io(CentOs7可以忽略),因为centos8默认使用podman代替docker,所以需要containerd.io,那我们就安装一下就好了
yum install https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.6-3.3.fc30.x86_64.rpm
安装docker
yum install docker-ce docker-ce-cli containerd.io
配置国内的docker源
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<EOF
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"],
"registry-mirrors": ["https://mirror.ccs.tencentyun.com"],
"registry-mirrors": ["https://registry.docker-cn.com"],
"registry-mirrors": ["http://hub-mirror.c.163.com"]
}
EOF