kubernetes集群搭建(2):docker私有仓库

kubernetes集群搭建(1):环境准备 中各节点已经安装好了docker,请确认docker已启动并正常运行

1.通过命令启动私库

docker run -d -p 5000:5000 --privileged=true -v /data/history:/data/registry registry

2.确认启动成功

[root@localhost ~]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
ce112003958f        registry            "/entrypoint.sh /e..."   12 days ago         Up 2 days           0.0.0.0:5000->5000/tcp   quirky_liskov
#查看私库中的镜像
[root@localhost ~]# curl -XGET http://192.168.100.6:5000/v2/_catalog {"repositories":["busybox","client","kubedns-amd64","nginx_local","rhel7/pod-infrastructure","server","tomcat"]} [root@localhost ~]#
#查看某一镜像的版本信息 访问方式为 http://ip:port/v2/镜像名字/tags/list [root@localhost ~]# curl -XGET http://192.168.100.6:5000/v2/server/tags/list {"name":"server","tags":["v1"]} [root@localhost ~]#

3.将镜像push到私库

docker tag nginx 192.168.100.6:5000/nginx_local:v1
docker push 192.168.100.6:5000/nginx_local:v1

4.在其他节点使用私库镜像时需要跟上对应的ip,端口和镜像在私库中的名字和版本

docker pull 192.168.100.6:5000/nginx_local:v1

 

posted @ 2018-04-23 10:02  肖哥哥  阅读(1596)  评论(0编辑  收藏  举报
生命不息  奋斗不止  每天进步一点点