k8s记录-docker私有仓库

docker pull registry 
docker run -d -v /data/registry:/var/lib/registry -p 5000:5000 --restart=always --privileged=true --name registry registry:latest
docker pull mysql
docker tag mysql:latest  192.168.0.1:5000/mysql:latest 

所有机器加入
vim /etc/docker/daemon.json
{
        "registry-mirrors": ["https://njrds9qc.mirror.aliyuncs.com"],
        "insecure-registries":["192.168.0.1:5000"]
}
systemctl daemon-reload
systemctl restart docker
#192.168.0.1
docker push 192.168.0.1:5000/mysql:latest 
ls /data/registry/docker/registry/v2/repositories
curl http://192.168.0.1:5000/v2/_catalog

其他机器pull
docker login 192.168.0.1:5000 输入用户名和密码:xf 123
cat ~/.docker/config.json 查看认证信息
创建 secret
kubectl create secret docker-registry
dockercfg-192 --docker-server=192.168.0.1:5000 --docker-username=xf --
docker-password=123
查看创建的 dockercfg-192
kubectl get secret |grep dockercfg-192

  

posted @ 2019-09-30 11:10  信方  阅读(522)  评论(0编辑  收藏  举报