私服的搭建是通过registry
server
1.拉取私服镜像:
docker pull registry
2.运行容器:
docker run -d -p 4999:5000 -v /home/dockerRepository:/var/lib/registry --name registry registry
client:
1.修改 /etc/dcoker/daemon.json
"insecure-registries":["172.16.1.192:4999"]//不用https 也可以推送
2.重启docker
systemctl daemon-reload
systemctl restart docker.service
3.修改镜像Tag
sudo docker tag jenkins 172.16.1.192:4999/jenkins
4.推送镜像到仓库
docker push 172.16.1.192:4999/jenkins:1.0
5.查看镜像仓库
docker exec -it jenkins ls /var/lib/registry/docker/registry/v2/repositories