Docker構建nexus私有倉庫

1.下載鏡像

[root@master_150 ~]# docker pull sonatype/nexus3

2.運行容器

[root@master_150 ~]# docker run -d -p 8081:8081 --name nexus -v /opt/nexus/nexus-data:/var/nexus-data --restart=always 192.168.1.196:5000/sonatype/nexus3:latest

3.登錄後臺

admin/admin123

4.創建倉庫

5.修改客戶端配置

docker私有倉庫服務器,默認是基於https傳輸的,所以我們需要在客戶端192.168.1.160做相關設置,不使用https傳輸

#新建配置文件
[root@master_150 ~]# vi /etc/docker/daemon.json

#將如下信息添加進去
{
    "registry-mirrors": ["https://registry.docker-cn.com"],
    "insecure-registries":["192.168.1.196:5000"]
}

#重啓docker
[root@master_150 ~]# systemctl daemon-reload
[root@master_150 ~]# systemctl restart docker

6.登錄倉庫

#注意這裏的端口是配置倉庫時選擇的端口號
[root@master_150 ~]# docker login -u admin -p admin123 172.16.77.71:8082 

7.上傳鏡像

[root@master_150 ~]# docker tag nginx:latest 172.16.77.71:8082/nginx:0.1
[root@master_150 ~]# docker push 172.16.77.71:8082/nginx:0.1

8.拉取鏡像

[root@master_150 ~]# docker pull 172.16.77.71:8082/nginx:0.1

9.檢索鏡像

[root@master_150 ~]# docker search 172.16.77.71:8082/nginx

 

歡迎各位大神評論點贊!

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