k8s 私有仓库

建立私有仓库

1.master先从公有仓库下载registry 镜像

docker pull registry

2.修改每个结点的docker配置文件

vim /etc/sysconfig/docker
INSECURE_REGISTRY='--insecure-registry=test-registry:5000'

3.master启动镜像

docker run -d -p 5000:5000 --restart=always --privileged --name registry -v /root/docker/my_registry:/var/lib/registry registry

如果先启动registry 容器的话再修改配置文件,要先停止或者删除容器,然后重启docker

把导入镜像,推进私有仓库

etcd.tar kube2sky.tar skydns.tar
docker load -i etcd.tar
docker load -i skydns.tar
docker load -i kube2sky.tar
可以用 docker tag name name2 修改镜像名字

#docker tag docker.io/kubernetes/etcd   test-registry:5000/etcd
#docker push test-registry:5000/etcd
The push refers to a repository [test-registry:5000/etcd]
5f70bf18a086: Pushed
bd143efc7820: Pushed
1768c2e82057: Pushed
fa2d9737fa36: Pushed
213b4bb251d6: Pushed
fedec15c59be: Pushed
055433d86af4: Pushed
7f02483a9752: Pushed

然后 docker push imagename 把镜像推上私有仓库
curl http://test-registry:5000/v2/_catalog
查看私有仓库里面的镜像
curl http://test-registry:5000/v2/imagename/tags/list
查看私有仓库里面的镜像的版本
curl http://test-registry:5000/v2/imagename/manifests/tag (镜像每一层的哈希值(digest))

你可能感兴趣的:(k8s 私有仓库)