1、下载registry镜像
docker pull registry
2、在daemon.json文件中添加私有镜像仓库地址并重启
vim /etc/docker/daemon.json { "registry-mirrors": ["https://4abdkxlk.mirror.aliyuncs.com"], #添加此段,“,”不可少
"insecure-registries": ["192.168.111.99:5000"] #ip是本机IP地址
}
systemctl daemon-reload
systemctl restart docker.service
3、运行私有仓库
docker run -d -p 5000:5000 -v /sheyu/myregistry/:/tmp/registry --privileged=true registry
4、案例演示
4.1、下载ubuntu镜像
4.2、ubuntu安装ifconfig命令
docker run -it ubuntu /bin/bash ifconfig apt-get update apt-get install net-tools
5、提交新镜像
docker commit -m="提交的描述信息" -a="作者" 容器ID 要创建的目标镜像名:[标签名] docker commit -m="ifconfig cmd add" -a="sheyu" 891f9aab9d65 sheyuubuntu:v1.0
6、push新镜像到私服库
curl -XGET http://192.168.111.99:5000/v2/_catalog docker tag myubuntu:v1.0 192.168.111.99:5000/myubuntu:v1.0 docker push 192.168.111.99:5000/myubuntu:v1.0 curl -XGET http://192.168.111.99:5000/v2/_catalog
7、拉取本地仓库并验证ifconfig
docker pull 192.168.111.99:5000/myubuntu:v1.0
docker run -it 192.168.111.99:5000/myubuntu:v1.0 /bin/bash
标签:5000,私有,192.168,myubuntu,v1.0,111.99,Docker,docker,搭建 From: https://www.cnblogs.com/zszitman/p/16842189.html