更换docker源为国内源
该博客文章提供了使用阿里云镜像源安装Docker、配置Docker镜像加速、以及替换多个第三方源镜像站的方法。
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/trusted.gpg.d/aliyun_docker.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/aliyun_docker.gpg
nano /etc/docker/daemon.json
输入以下内容:
{
"registry-mirrors": [
"https://docker.m.daocloud.io",
"https://dockerhub.icu",
"https://docker.chenby.cn",
"https://docker.1panel.live",
"https://docker.awsl9527.cn",
"https://docker.anyhub.us.kg",
"https://dhub.kubesre.xyz"
]
}
重启docker
service docker restart
建议采用添加前缀的方式进行,如ghcr.io/home-assistant/home-assistant:2024.8.1
替换为m.daocloud.io/ghcr.io/home-assistant/home-assistant:2024.8.1
也可以替换前缀:
源站 | 镜像站 |
---|---|
cr.l5d.io | 5d.m.daocloud.io |
docker.elastic.co | elastic.m.daocloud.io |
docker.io | docker.m.daocloud.io |
gcr.io | gcr.m.daocloud.io |
ghcr.io | ghcr.m.daocloud.io |
k8s.gcr.io | k8s-gcr.m.daocloud.io |
registry.k8s.io | k8s.m.daocloud.io |
mcr.microsoft.com | mcr.m.daocloud.io |
nvcr.io | nvcr.m.daocloud.io |
quay.io | quay.m.daocloud.io |
registry.jujucharms.com | jujucharms.m.daocloud.io |
rocks.canonical.com | rocks-canonical.m.daocloud.io |