给Docker换国内镜像源

网站所有资源都有,可联系VX:bjlyxy1688
图片[1]-给Docker换国内镜像源-天时网

参考 https://www.hostloc.com/thread-800586-1-1.html

图片[2]-给Docker换国内镜像源-天时网

安装

<span class="token comment"># 安装docker</span>
<span class="token function">apt</span> <span class="token function">install</span> -y docker.io
systemctl start docker
systemctl <span class="token builtin class-name">enable</span> docker
<span class="token comment"># 修改源,加多个国内源</span>
<span class="token function">sudo</span> <span class="token function">tee</span> /etc/docker/daemon.json <span class="token operator"><<-</span><span class="token string">'EOF'
{
"registry-mirrors": [
"https://0b27f0a81a00f3560fbdc00ddd2f99e0.mirror.swr.myhuaweicloud.com",
"https://ypzju6vq.mirror.aliyuncs.com",
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn"
]
}
EOF</span>
<span class="token comment"># 重启</span>
<span class="token function">sudo</span> systemctl daemon-reload
<span class="token function">sudo</span> systemctl restart docker
<span class="token comment"># 安装docker</span>
<span class="token function">apt</span> <span class="token function">install</span> -y docker.io
systemctl start docker
systemctl <span class="token builtin class-name">enable</span> docker

<span class="token comment"># 修改源,加多个国内源</span>
<span class="token function">sudo</span> <span class="token function">tee</span> /etc/docker/daemon.json <span class="token operator"><<-</span><span class="token string">'EOF'
{
  "registry-mirrors": [
    "https://0b27f0a81a00f3560fbdc00ddd2f99e0.mirror.swr.myhuaweicloud.com",
    "https://ypzju6vq.mirror.aliyuncs.com",
    "https://registry.docker-cn.com",
    "http://hub-mirror.c.163.com",
    "https://docker.mirrors.ustc.edu.cn"
  ]
}
EOF</span>

<span class="token comment"># 重启</span>
<span class="token function">sudo</span> systemctl daemon-reload
<span class="token function">sudo</span> systemctl restart docker
# 安装docker apt install -y docker.io systemctl start docker systemctl enable docker # 修改源,加多个国内源 sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": [ "https://0b27f0a81a00f3560fbdc00ddd2f99e0.mirror.swr.myhuaweicloud.com", "https://ypzju6vq.mirror.aliyuncs.com", "https://registry.docker-cn.com", "http://hub-mirror.c.163.com", "https://docker.mirrors.ustc.edu.cn" ] } EOF # 重启 sudo systemctl daemon-reload sudo systemctl restart docker

确认

docker info<span class="token operator">|</span><span class="token function">grep</span> Mirrors -A <span class="token number">10</span>
docker info<span class="token operator">|</span><span class="token function">grep</span> Mirrors -A <span class="token number">10</span>
docker info|grep Mirrors -A 10
图片[3]-给Docker换国内镜像源-天时网
© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
Life is the flower for which love is the honey.
生命如花,爱情是蜜
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片快捷回复

    暂无评论内容