77) Docker-ce 清华源安装

1- CentOS7

1.1- 国内清华源

rm -rf /etc/yum.repos.d/*
curl -o /etc/yum.repos.d/CentOS-Base.repo https://files-cdn.cnblogs.com/files/lemanlai/CentOS-7.repo.sh
curl -o /etc/pki/rpm-gpg/RPM-GPG-KEY-7 https://mirror.tuna.tsinghua.edu.cn/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7
yum install epel-release -y
yum clean all
yum makecache fast
yum install nmap telnet curl wget vim lrzsz bind-utils -y #安装基本工具

1.2- docker-ce清华源

yum remove docker docker-common docker-selinux docker-engine -y  #如果你之前安装过 docker,请先删掉
yum install -y yum-utils device-mapper-persistent-data lvm2 #安装一些依赖
curl -o /etc/yum.repos.d/docker-ce.repo https://files-cdn.cnblogs.com/files/lemanlai/docker-ce.repo.sh
yum clean all
yum makecache fast

2- ubuntu20.04

2.1- 清华源

cat << EOF > /etc/apt/sources.list   
deb https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
EOF
apt-get install nmap telnet curl wget vim lrzsz bind-utils -y #安装基本工具
apt-get update

2.2- docker-ce 清华源

apt-get remove docker docker-engine docker.io  -y #如果你过去安装过 docker,先删掉
apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y #安装依赖
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -  #信任 Docker 的 GPG 公钥
add-apt-repository    "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu    $(lsb_release -cs)    stable" #添加软件仓库
apt-get update
apt-get install docker-ce

相关推荐