03-Docker下载加速

03-Docker下载加速

docker下载加速

方式1:使用 网易数帆、阿里云等容器镜像仓库进行下载。

网易数帆官网:https://sf.163.com/

例如,下载网易数帆镜像中的mysql。(网易数帆的地址为 hub.c.163.com,网易数帆对dockerhub官方的镜像命名空间为 library)。

shell 复制代码
docker pull hub.c.163.com/library/mysql:latest

方式2:配置阿里云加速。

阿里云容器镜像服务:https://cr.console.aliyun.com/cn-hangzhou/instances

登录阿里云,进入 工作台 -> 容器镜像服务 -> 镜像工具 -> 镜像加速器

里面提供了一个加速器地址:https://xxxxx.mirror.aliyuncs.com,将该地址配置到docker中:

1. 安装/升级Docker客户端

推荐安装1.10.0以上版本的Docker客户端,参考文档docker-ce

2. 配置镜像加速器

针对Docker客户端版本大于 1.10.0 的用户

您可以通过修改daemon配置文件/etc/docker/daemon.json来使用加速器

shell 复制代码
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://xxxxx.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

注意:上述的tee可以用vim来代替,复制以下内容到daemon.json文件中即可

shell 复制代码
{
  "registry-mirrors": ["https://xxxxx.mirror.aliyuncs.com"]
}

然后再刷新配置,重启docker即可

shell 复制代码
sudo systemctl daemon-reload
sudo systemctl restart docker

使用方式2可以直接下载官方的镜像,且镜像tag为官方tag,不需要加上云服务商的地址。

例如:

shell 复制代码
docker pull mysql:latest
相关推荐
Flash.kkl2 小时前
Linux——进程信号
运维·服务器
苏宸啊3 小时前
Linux权限
linux·运维·服务器
Gofarlic_oms13 小时前
Windchill用户登录与模块访问失败问题排查与许可证诊断
大数据·运维·网络·数据库·人工智能
xqhoj4 小时前
Linux——make、makefile
linux·运维·服务器
文亭湖畔程序猿4 小时前
Debian 12 日常命令 & nano 快捷键速查表
运维·debian
张童瑶4 小时前
Linux 在线安装编译Python3.11
linux·运维·python3.11
ziqibit4 小时前
debian Live with Persistence 持久化U盘的debian系统
运维·debian
Shi_haoliu4 小时前
SolidTime 在 Rocky Linux 9.5 上的完整部署流程
linux·运维·nginx·postgresql·vue·php·laravel
HIT_Weston6 小时前
100、【Ubuntu】【Hugo】搭建私人博客:元信息&翻译(一)
linux·运维·ubuntu
C_心欲无痕6 小时前
Docker 的镜像与容器
运维·docker·容器