![图片[1]-给Docker换国内镜像源-天时网](https://cdn.1024.ee/wp-content/uploads/2021/01/mini_-2021-01-31-at-20.44.14-930x336.png)
参考 https://www.hostloc.com/thread-800586-1-1.html
安装
<span class="token comment"># 安装docker</span><span class="token function">apt</span> <span class="token function">install</span> -y docker.iosystemctl start dockersystemctl <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换国内镜像源-天时网](https://cdn.1024.ee/wp-content/uploads/2021/01/mini_-2021-01-31-at-20.44.14-1024x370.png)
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容