Docker修改鏡像源地址

一、國內常用鏡像源

  • Docker 官方中國區:https://registry.docker-cn.com
  • 網易鏡像源:http://hub-mirror.c.163.com
  • USTC:https://docker.mirrors.ustc.edu.cn
  • 阿里雲註冊:https://cr.console.aliyun.com/

二、修改鏡像源方法

1、–registry-mirror 參數

  在運行命令中加上–registry-mirror參數,僅對當前的命令有效 。

docker run container-name --registry-mirror=https://docker.mirrors.ustc.edu.cn

2、修改 /etc/docker/daemon.json

  在/etc/docker目錄下修改或新增daemon.json文件,設置鏡像源。

# vi /etc/docker/daemon.json
{
  "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
}

  此種方法修改後需要重啓docker。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章