天天看點

Linux centos中搭建 Docker私有倉庫

搭建docker鏡像,并将開發的資料打包成鏡像,推送到docker的私有倉庫,友善開發。

搭建的步驟如下:

1、拉取registry鏡像

docker      
Linux centos中搭建 Docker私有倉庫

2、生成registry容器,開放5000端口

docker      
docker run -d -p 5000:5000 -v /data/registry:/tmp/registry registry      
docker ps      
docker exec      
Linux centos中搭建 Docker私有倉庫
Linux centos中搭建 Docker私有倉庫

3、用戶端設定daemon.json檔案 (指定私有倉庫位置)

vim      

101.37.171.235:5000 為自己機器的外網IP和端口号

“https://docker.mirrors.ustc.edu.cn”, “https://hub-mirror.c.163.com” 為可用的外網docker鏡像

{"insecure-registries":["101.37.171.235:5000"],
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn", "https://hub-mirror.c.163.com"]
}      

4、建立本地的鏡像标簽

docker      
docker tag httpd:latest 101.37.171.235:5000/httpd      
Linux centos中搭建 Docker私有倉庫

5、上傳鏡像并測試

docker push 101.37.171.235:5000/httpd      
curl      
Linux centos中搭建 Docker私有倉庫

6、下載下傳鏡像測試

docker pull 101.37.171.235:5000/httpd      
Linux centos中搭建 Docker私有倉庫

附注、設定docker的registry 開啟自啟動

docker update --restart=always 1778d51b6342      

繼續閱讀