RockyLinux安装docker并配置可用镜像源 402次阅读 Centos • 学习归纳 2024-06-27 ## 一、安装docker-ce ##### 1、删除已经安装的docker ```shell sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine ``` ![image-20240627145322414](\doc\18docker\image-20240627145322414.png) ##### 2、安装系统工具 ```shell [root@localhost ~]# sudo yum install -y yum-utils device-mapper-persistent-data lvm2 ``` ![image-20240627145605852](\doc\18docker\image-20240627145605852.png) ##### 3、添加阿里云的docker yum repo源 ```shell [root@localhost ~]# sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo ``` ![image-20240627145826876](\doc\18docker\image-20240627145826876.png) ##### 4、安装docker-ce(Community Edition) ```shell [root@localhost ~]# yum install docker-ce -y ``` ![image-20240627150504693](\doc\18docker\image-20240627150504693.png) ##### 5、设置开机启动并启动docker ```shell [root@localhost ~]# systemctl enable docker && systemctl start docker ``` ![image-20240627151859781](\doc\18docker\image-20240627151859781.png) ##### 6、查看docker状态 ```shell [root@localhost ~]# systemctl status docker ``` ![image-20240627152023219](\doc\18docker\image-20240627152023219.png) 至此docker安装完成。 ------ ## 二、配置可用镜像源 ##### 1、尝试从默认服务器上pull nginx镜像,可以发现pull不下来 ![image-20240627152326026](\doc\18docker\image-20240627152326026.png) ##### 2、修改deamon.json文件 ```shell [root@localhost ~]# vim /etc/docker/daemon.json ``` ##### 3、按照如下格式填入可用的镜像源(自行百度) ```json { "registry-mirrors": [ "https://docker.m.daocloud.io", "https://dockerhub.timeweb.cloud", "https://huecker.io", "https://noohub.ru" ] } ``` ![image-20240627160452113](\doc\18docker\image-20240627160452113.png) ##### 4、重启docker deamon和docker服务 ```shell [root@localhost ~]# systemctl daemon-reload && systemctl restart docker ``` ##### 5、查看docker信息 ```shell [root@localhost docker]# docker info ``` ![image-20240627160631710](\doc\18docker\image-20240627160631710.png) ##### 6、再次尝试pull nginx镜像 ![image-20240627160818598](\doc\18docker\image-20240627160818598.png) 可以看到已经可以pull下来了,配置完成! 另外,按照国内的大环境,正规的镜像服务器会越来越少......有能力建议上v2raya 最后一次更新于2024-06-27 None
0 条评论