docker镜像加速

CSDN 2024-10-01 14:37:02 阅读 91

近期,国内云计算和容器技术社区面临了一项挑战:多个镜像加速站点被关闭。这些加速站点原本为开发者和企业提供了快速访问和下载海外 Docker 镜像的能力,以下是一些可以用的镜像地址

<code>腾讯云镜像加速器地址:https://mirror.ccs.tencentyun.com

中国科学技术大学:https://docker.mirrors.ustc.edu.cn

Docker官方镜像(中国区)镜像加速:https://registry.docker-cn.com

网易云镜像加速器地址:http://hub-mirror.c.163.com

南京大学镜像加速器地址:https://docker.nju.edu.cn

阿里云镜像加速器地址:https://xxxxxx.mirror.aliyuncs.com

Daocloud 镜像加速器地址:https://docker.m.daocloud.io

1、配置阿里云镜像加速器

阿里云提供了免费使用的镜像加速服务。以下是具体的配置步骤:

登录到阿里云控制台 https://cr.console.aliyun.com/

进入“镜像中心”,点击左侧菜单中的“镜像加速器”。

将页面中展示的加速器地址记下来,例如 https://xxxxxx.mirror.aliyuncs.com。

在这里插入图片描述

<code>docker info | grep -A1 "Registry Mirrors"

配置多个镜像地址

# cat /etc/docker/daemon.json

{

"registry-mirrors": [

"https://i3nc9nvv.mirror.aliyuncs.com",

"https://docker.m.daocloud.io",

"https://dockerhub.timeweb.cloud"

],

"insecure-registries": ["harbor-local.kubernets.cn"],

"log-driver":"json-file",

"log-opts": {

"max-size":"500m",

"max-file":"3"

}

}

2、更多镜像加速

# docker hub镜像加速

mkdir -p /etc/containerd/certs.d/docker.io

cat > /etc/containerd/certs.d/docker.io/hosts.toml << EOF

server = "https://docker.io"

[host."https://docker.m.daocloud.io"]

capabilities = ["pull", "resolve"]

[host."https://reg-mirror.qiniu.com"]

capabilities = ["pull", "resolve"]

EOF

# registry.k8s.io镜像加速

mkdir -p /etc/containerd/certs.d/registry.k8s.io

tee /etc/containerd/certs.d/registry.k8s.io/hosts.toml << 'EOF'

server = "https://registry.k8s.io"

[host."https://k8s.m.daocloud.io"]

capabilities = ["pull", "resolve", "push"]

EOF

# docker.elastic.co镜像加速

mkdir -p /etc/containerd/certs.d/docker.elastic.co

tee /etc/containerd/certs.d/docker.elastic.co/hosts.toml << 'EOF'

server = "https://docker.elastic.co"

[host."https://elastic.m.daocloud.io"]

capabilities = ["pull", "resolve", "push"]

EOF

# gcr.io镜像加速

mkdir -p /etc/containerd/certs.d/gcr.io

tee /etc/containerd/certs.d/gcr.io/hosts.toml << 'EOF'

server = "https://gcr.io"

[host."https://gcr.m.daocloud.io"]

capabilities = ["pull", "resolve", "push"]

EOF

# ghcr.io镜像加速

mkdir -p /etc/containerd/certs.d/ghcr.io

tee /etc/containerd/certs.d/ghcr.io/hosts.toml << 'EOF'

server = "https://ghcr.io"

[host."https://ghcr.m.daocloud.io"]

capabilities = ["pull", "resolve", "push"]

EOF

# k8s.gcr.io镜像加速

mkdir -p /etc/containerd/certs.d/k8s.gcr.io

tee /etc/containerd/certs.d/k8s.gcr.io/hosts.toml << 'EOF'

server = "https://k8s.gcr.io"

[host."https://k8s-gcr.m.daocloud.io"]

capabilities = ["pull", "resolve", "push"]

EOF

# mcr.m.daocloud.io镜像加速

mkdir -p /etc/containerd/certs.d/mcr.microsoft.com

tee /etc/containerd/certs.d/mcr.microsoft.com/hosts.toml << 'EOF'

server = "https://mcr.microsoft.com"

[host."https://mcr.m.daocloud.io"]

capabilities = ["pull", "resolve", "push"]

EOF

# nvcr.io镜像加速

mkdir -p /etc/containerd/certs.d/nvcr.io

tee /etc/containerd/certs.d/nvcr.io/hosts.toml << 'EOF'

server = "https://nvcr.io"

[host."https://nvcr.m.daocloud.io"]

capabilities = ["pull", "resolve", "push"]

EOF

# quay.io镜像加速

mkdir -p /etc/containerd/certs.d/quay.io

tee /etc/containerd/certs.d/quay.io/hosts.toml << 'EOF'

server = "https://quay.io"

[host."https://quay.m.daocloud.io"]

capabilities = ["pull", "resolve", "push"]

EOF

# registry.jujucharms.com镜像加速

mkdir -p /etc/containerd/certs.d/registry.jujucharms.com

tee /etc/containerd/certs.d/registry.jujucharms.com/hosts.toml << 'EOF'

server = "https://registry.jujucharms.com"

[host."https://jujucharms.m.daocloud.io"]

capabilities = ["pull", "resolve", "push"]

EOF

# rocks.canonical.com镜像加速

mkdir -p /etc/containerd/certs.d/rocks.canonical.com

tee /etc/containerd/certs.d/rocks.canonical.com/hosts.toml << 'EOF'

server = "https://rocks.canonical.com"

[host."https://rocks-canonical.m.daocloud.io"]

capabilities = ["pull", "resolve", "push"]

EOF



声明

本文内容仅代表作者观点,或转载于其他网站,本站不以此文作为商业用途
如有涉及侵权,请联系本站进行删除
转载本站原创文章,请注明来源及作者。