yujin2010good
作者yujin2010good2019-01-14 10:20
系统工程师, 大型零售巨头

docker registry学习

字数 4610阅读 1101评论 0赞 2

Registry用于保存docker镜像,包括镜像的层次结构和元数据用户可以自建Registry,也可以使用官方的Docker Hub分类:

  1. Sponsor Registry:第三方的Registry,供客户和Docker社区使用
  2. Mirror Registry:第三方的Registry,供客户使用
  3. Vendor Registry:由发布Docker镜像的供应商提供registry
  4. Private Registry:通过防火墙和额外的安全层的私有实体提供的registry

https、http

docker-distribution

https://hub.docker.com/

运行registry方式
1、docker启动
2、yum install registry


yum安装
/etc/docker-distribution/registry/config.yml
/usr/bin/registry
/usr/lib/systemd/system/docker-distribution.service
/usr/share/doc/docker-distribution-2.6.2
/usr/share/doc/docker-distribution-2.6.2/AUTHORS
/usr/share/doc/docker-distribution-2.6.2/CONTRIBUTING.md
/usr/share/doc/docker-distribution-2.6.2/LICENSE
/usr/share/doc/docker-distribution-2.6.2/MAINTAINERS
/usr/share/doc/docker-distribution-2.6.2/README.md
/var/lib/registry

[root@master ~]# cd /etc/docker-distribution/registry/
[root@master registry]# vi config.yml 
version: 0.1
log:
  fields:
    service: registry
storage:
    cache:
        layerinfo: inmemory
    filesystem:
        rootdirectory: /var/lib/registry                    存储
http:
    addr: :5000

启动服务

[root@master registry]# systemctl start docker-distribution
[root@master registry]# ss -tnl
State       Recv-Q Send-Q                                                  Local Address:Port                                                                 Peer Address:Port              
LISTEN      0      128                                                         127.0.0.1:2379                                                                            *:*                  
LISTEN      0      128                                                         127.0.0.1:2380                                                                            *:*                  
LISTEN      0      128                                                         127.0.0.1:8080                                                                            *:*                  
LISTEN      0      128                                                                 *:22                                                                              *:*                  
LISTEN      0      100                                                         127.0.0.1:25                                                                              *:*                  
LISTEN      0      128                                                                :::5000                                                                           :::*                  
LISTEN      0      128                                                                :::10251                                                                          :::*

换到客户端服务器上
先打标,指定出仓库地址

[root@localhost ~]# docker tag wolfhttpd:v0.1-6 10.249.100.206:5000/wolfhttpd:v0.1-6
[root@localhost ~]# docker images
REPOSITORY                                             TAG                 IMAGE ID            CREATED             SIZE
wolfhttpd                                              v0.1-6              44c7bf47977c        8 days ago          7.33MB
node02.wolf.com:5000/wolfhttpd                         v0.1-6              44c7bf47977c        8 days ago          7.33MB
10.249.100.206:5000/wolfhttpd                          v0.1-6              44c7bf47977c        8 days ago          7.33MB
wolfhttpd                                              v0.1-5              af03cafbdaf9        8 days ago          7.33MB

[root@localhost ~]# docker push 10.249.100.206:5000/wolfhttpd:v0.1-6
The push refers to repository [10.249.100.206:5000/wolfhttpd]
Get https://10.249.100.206:5000/v2/: http: server gave HTTP response to HTTPS client

这里报错了,因为默认使用https

[root@localhost ~]#  cat /etc/docker/daemon.json
{
        "registry-mirrors": ["https://njrds9qc.mirror.aliyuncs.com"],
        "insecure-registries":["10.249.100.205:5000"]
}

[root@localhost ~]# docker push 10.249.100.206:5000/wolfhttpd:v0.1-6
The push refers to repository [10.249.100.206:5000/wolfhttpd]
bcdf67389298: Pushed 
8c1a5954098e: Pushed 
9c836f7e6992: Pushed 
9d73c071373b: Pushed 
8a788232037e: Pushed 
v0.1-6: digest: sha256:99e67356af4ab736dd268070a75efbe511172ad5764a7416507bdc0f8ecd5afa size: 1360
[root@localhost ~]# 

这里也是分层存放,分层推送

下载

[root@master wolfhttpd]# docker pull 10.249.100.206:5000/wolfhttpd:v0.1-6
v0.1-6: Pulling from wolfhttpd
90e01955edcd: Pull complete 
91cae817a142: Pull complete 
a32f3239f655: Pull complete 
6ed8f835e830: Pull complete 
691dfabb802f: Pull complete 
Digest: sha256:99e67356af4ab736dd268070a75efbe511172ad5764a7416507bdc0f8ecd5afa
Status: Downloaded newer image for 10.249.100.206:5000/wolfhttpd:v0.1-6

私有库
harbor。漂亮的web界面

如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

2

添加新评论0 条评论

Ctrl+Enter 发表

作者其他文章

相关文章

相关问题

相关资料

X社区推广