centos7安装docker,清华大学源
#uninstall docker
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
#install docker tools
sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
#Tsinghua University yum repository
sudo yum-config-manager \
--add-repo \
https://mydream.ink/utils/container/docker-ce.repo
#install docker-ce
sudo yum install docker-ce docker-ce-cli containerd.io
#image speed up
mkdir -p /etc/docker
cat <<EOF >>/etc/docker/daemon.json
{
"registry-mirrors": [
"https://dockerhub.azk8s.cn",
"https://reg-mirror.qiniu.com"
]
}
EOF
#start docker
sudo systemctl daemon-reload
sudo systemctl start docker
#stop swap
swapoff -a
sed -i -e '/swap/d' /etc/fstab
echo 'vm.swappiness=0' > /etc/sysctl.d/k8s.conf
sysctl -p /etc/sysctl.d/k8s.conf