(如果安装过Docker否则跳过此步) 以防万一最好执行一遍
yum -y remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
yum -y install yum-utils
(此处设置为阿里云的仓库地址)
yum-config-manager
–add-repo
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
docker-ce 社区版 docker-ee 企业版
sudo yum -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
systemctl start docker
测试之前先配置一个阿里云加速器(不然你一辈子都别想run成功hello-world)
v
测试hello world
docker run hello-world
最后 这个是docker centos安装手册地址https://docs.docker.com/engine/install/centos/
关于卸载docker
sudo yum -y remove docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
rm -rf /var/lib/docker
同步时间
ntpdate time.windows.com
如果出现报错 docker: error pulling image configuration: download failed after attempts=6: dial tcp 104.18.122.25:443: i/o timeout.
则输入以下命令
echo {“registry-mirrors”:[“https://hub-mirror.c.163.com”,“https://registry.aliyuncs.com”,“https://registry.docker-cn.com”,“https://docker.mirrors.ustc.edu.cn”]} > /etc/docker/daemon.json
如果出现这个异常就是安装docker-ce过程中报错解决方法如下
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all && yum makecache fast && yum -y install docker-ce
irrors.aliyun.com/repo/Centos-7.repo
yum clean all && yum makecache fast && yum -y install docker-ce