root@localhost ~]# sudo yum-config-manager \ > --add-repo \ > https://download.docker.com/linux/centos/docker-ce.repo > Loaded plugins: fastestmirror > /usr/lib/python2.7/site-packages/yum/misc.py:133: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal > return lambda s: s.lower() == pat > [root@localhost ~]# vim /usr/lib/python2.7/site-packages/yum/misc.py > [root@localhost ~]# sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo > Loaded plugins: fastestmirror > [root@localhost ~]# sudo yum install docker-ce docker-ce-cli containerd.io > Loaded plugins: fastestmirror > Loading mirror speeds from cached hostfile > epel/x86_64/metalink | 9.8 kB 00:00:00 * base: mirrors.cqu.edu.cn
报错解决方法
vim /usr/lib/python2.7/site-packages/yum/misc.py
import sys
reload(sys)
sys.setdefaultencoding(‘utf8’)
配置国内加速
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-‘EOF’
{
“registry-mirrors”: [“https://82m9ar63.mirror.aliyuncs.com”]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
重启失败,原因在处理/etc/docker/daemon.json的时候没有缩进,
[root@localhost ~]# cat /etc/docker/daemon.json
{
“registry-mirrors”: [“https://82m9ar63.mirror.aliyuncs.com”]
}
[root@localhost ~]#
重新配置缩进之后,重启成功
sudo systemctl daemon-reload
sudo systemctl restart docker