docker安装简易版与加速

首先把阿里云的centos7和epel安装上
替换国内镜像源(备选方案)
若官方源长期访问困难,可改用阿里云Docker镜像源:

创建 /etc/yum.repos.d/docker-ce.repo,内容如下:
[docker-ce]
name=Docker CE Repository
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
执行 dnf clean all && dnf makecache 重建缓存。
通过以上步骤,可解决绝大多数因网络、证书、环境限制导致的Docker仓库配置失败问题。若仍报错,可结合 curl -v 的详细输出进一步定位(如代理证书、协议版本等更细节的SSL错误)。
在vim的普通模式下键入“ggdG”即可删除其中全部内容。然后换成上面的就可以下了
再下载
sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

下载完成启动
systemctl start docker

配置加速器:
引用镜像
https://www.bilibili.com/video/BV1N53qzZEhi?spm_id_from=333.788.recommend_more_video.1&vd_source=f783965d0f445c17f73d465b83e86655

牛皮,真可以下

[root@yinyujie ~]# vi /etc/docker/daemon.json
[root@yinyujie ~]#
[root@yinyujie ~]#
[root@yinyujie ~]# vi /etc/docker/daemon.json
[root@yinyujie ~]#
[root@yinyujie ~]#
[root@yinyujie ~]# systemctl daemon-reload
[root@yinyujie ~]#
[root@yinyujie ~]#
[root@yinyujie ~]#
[root@yinyujie ~]# systemctl restart docker
[root@yinyujie ~]#
[root@yinyujie ~]#
[root@yinyujie ~]# docker pull nginx

不过下的有点慢 要5分钟左右

docker pull nginx pull:下载的意思
docker run nginx run:启动镜像,跑起来了nginx
这时启动的应用nginx叫容器

image
image
原因:daemon.json配错导致失败

{
"registry-mirrors": [
"https://docker.1ms.run",
"https://docker.xuanyuan.me"
]
}
正确的:
成功

posted on 2025-10-10 11:13  爱尔奎特‘殷’  阅读(8)  评论(0)    收藏  举报