zoukankan      html  css  js  c++  java
  • 构建私有Docker Registry

    1.设置insecure-registry:

    可能会出现无法push镜像到私有仓库的问题。

    这是因为我们启动的registry服务不是安全可信赖的。

    1) sudo vim /etc/default/docker 
    DOCKER_OPTS="--insecure-registry 10.229.43.237:5000" 

    2) $ sudo service docker restart

    2.获取registry镜像 

    Registry以前是用Python写的,考虑到效率问题,

    后来用Go重写一遍,所以github看到的是distribution。

    https://github.com/docker/distribution

    $ sudo docker pull registry:2.5.1

    3.启动registry容器

    $ sudo docker run -d -v /opt/registry:/var/lib/registry -p 10000:5000 --restart=always --name registry registry:2.5.1

    $ netstat -an | grep 5000 检查5000端口是否被占用。

    Registry服务默认会将上传的镜像保存在容器的/var/lib/registry,

    我们将主机的/opt/registry目录挂载到该目录,即可实现将镜像保存到主机的/opt/registry目录。

    打开浏览器输入http://127.0.0.1:10000/v2,可以访问说明registry运行正常。

    4.Tag镜像

    $ sudo docker tag hello-world 127.0.0.1:10000/hello-world

    $ sudo docker images 可以看到新产生了一个本地镜像127.0.0.1:10000/hello-world

    5.推送本地镜像到私有Registry

    $ sudo docker push 127.0.0.1:10000/hello-world

    打开浏览器输入http://127.0.0.1:10000/v2/_catalog,检查registry是否包含hello-world

    6.删除本地镜像

    $ sudo docker rmi 127.0.0.1:10000/hello-world

    7.重新拉取镜像

    $ sudo docker pull 127.0.0.1:10000/hello-world

    $ sudo docker run 127.0.0.1:10000/hello-world

  • 相关阅读:
    What's the most secure desktop operating system?
    合肥一中在校学生丁雯琪(中美班)被麻省理工学院(MIT)录取
    Classic Computer Science 1980s-1990s
    HOWTO do Linux kernel development
    选择器zuoye
    HTML+css 小组件
    弹性盒子
    CSS3 学习笔记(动画 多媒体查询)
    CSS3 学习笔记(边框 背景 字体 图片 旋转等)
    学习笔记css3
  • 原文地址:https://www.cnblogs.com/edisonxiang/p/6070540.html
Copyright © 2011-2022 走看看