docker 镜像仓库的管理

news2024/9/20 1:07:25

目录

1 docker 镜像仓库介绍

1.1 什么是docker仓库

1.2 docker hub

2 docker仓库的工作原理

2.1 仓库中的三个角色

2.2 pull原理

2.3 push原理

3 使用互联网上提供的托管镜像仓库

3.1 docker hub 镜像仓库

3.1.1 docker hub 镜像仓库介绍

3.1.2 docker hub的使用方法

4 搭建docker的私有仓库

4.1 为什么搭建私有仓库

4.2 搭建简单的Registry仓库

4.2.1 下载Registry镜像

4.2.2 开启Registry

4.2.3 上传镜像到仓库中

4.4.4 为Registry提加密传输

4.4.5 htpasswd工具 创建用户认证

4.3 构建企业级私有仓库

4.3.1 私有仓库之HARBOR

4.3.1.1 HARBOR 的获取

4.3.1.2 HARBOR 的介绍

4.3.1.3 部署harbor

4.3.1.4 ChartMuseum 参数

4.3.1.5 管理HARBOR

4.5.1.6 查看镜像加载

4.5.1.7 实现效果


1 docker 镜像仓库介绍

1.1 什么是docker仓库

Docker 仓库( Docker Registry 是用于存储和分发 Docker 镜像的集中式存储库。
它就像是一个大型的镜像仓库,开发者可以将自己创建的 Docker 镜像推送到仓库中,也可以从仓库中拉取所需的镜像。
Docker 仓库可以分为公共仓库和私有仓库:
  • 公共仓库,如 Docker Hub,任何人都可以访问和使用其中的镜像。许多常用的软件和应用都有在 Docker Hub 上提供的镜像,方便用户直接获取和使用。 例如,想要部署一个 Nginx 服务器,就可以从 Docker Hub 上拉取 Nginx 的镜像。
  • 私有仓库则是由组织或个人自己搭建和管理的,用于存储内部使用的、不希望公开的镜像。 比如,一家企业为其特定的业务应用创建了定制化的镜像,并将其存储在自己的私有仓库中, 以保证安全性和控制访问权限。
通过 Docker 仓库,开发者能够方便地共享和复用镜像,加速应用的开发和部署过程。

1.2 docker hub

以下是官网链接
https://hub.docker.com/icon-default.png?t=N7T8https://hub.docker.com/

2 docker仓库的工作原理

2.1 仓库中的三个角色

  • index docker索引服务,负责并维护有关用户帐户、镜像的校验以及公共命名空间的信息。
  • registry docker仓库,是镜像和图表的仓库,它不具有本地数据库以及不提供用户认证,通过Index Auth serviceToken的方式进行认证
  • Registry Client Docker充当registry客户端来维护推送和拉取,以及客户端的授权。

2.2 pull原理

镜像拉取分为以下几步:
1.docker 客户端向 index 发送镜像拉去请求并完成与 index 的认证
2.index 发送认证 token 和镜像位置给 dockerclient
3.dockerclient 携带 token 和根据 index 指引的镜像位置取连接 registry
4.Registry 会根据 client 持有的 token index 核实身份合法性
5.index 确认此 token 合法性
6.Registry 会根据 client 的请求传递镜像到客户端

2.3 push原理

镜像上传的步骤:

        1.client向index发送上传请求并完成用户认证

        2.index会发方tokenclient来证明client的合法性

        3.client携带index提供的token连接Registry

        4.Registry向index合适token的合法性

        5.index证实token的合法性

        6.Registry开始接收客户端上传过来的镜像

3 使用互联网上提供的托管镜像仓库

3.1 docker hub 镜像仓库

3.1.1 docker hub 镜像仓库介绍

Docker Hub Docker 官方提供的一个公共的镜像仓库服务。
它是 Docker 生态系统中最知名和广泛使用的镜像仓库之一,拥有大量的官方和社区贡献的镜像。
以下是 Docker Hub 的一些关键特点和优势:
  • 丰富的镜像资源:涵盖了各种常见的操作系统、编程语言运行时、数据库、Web 服务器等众多应用 的镜像。 例如,可以轻松找到 Ubuntu、CentOS 等操作系统的镜像,以及 MySQLRedis 等数据库的镜像。
  • 官方支持:提供了由 Docker 官方维护的一些重要镜像,确保其质量和安全性。
  • 社区贡献:开发者们可以自由上传和分享他们创建的镜像,促进了知识和资源的共享。
  • 版本管理:对于每个镜像,通常都有多个版本可供选择,方便用户根据需求获取特定版本。
  • 便于搜索:用户可以通过关键词轻松搜索到所需的镜像

3.1.2 docker hub的使用方法

要想上传镜像到镜像仓库首先要做的是就是需要登录

输入用户密码即可登录成功
dockerfile]# docker login 

Log in with your Docker ID or email address to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com/ to create one.
You can log in with your password or a Personal Access Token (PAT). Using a limited-scope PAT grants better security and is required for organizations using SSO. Learn more at https://docs.docker.com/go/access-tokens/

Username: 用户名
Password: 密码
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credential-stores

Login Succeeded

给镜像打上标签 :docker tag [原来的镜像名]  用户名/镜像名:标签

上传本地镜像:docker push  [用户名|网址|IP地址]/镜像名:标签


[root@rockynode-1 dockerfile]# docker images 
REPOSITORY           TAG           IMAGE ID       CREATED         SIZE
busybox              latest        65ad0d468eb1   15 months ago   4.26MB
timinglee/game2048   latest        19299002fdbe   7 years ago     55.5MB
timinglee/mario      latest        9a35a9e43e8c   8 years ago     198MB

# 给镜像打上标签
[root@rockynode-1 dockerfile]# docker tag timinglee/game2048:latest 15307743762/shuyan:game2048

# 查看多了一个15307743762/shuyan 的镜像
[root@rockynode-1 dockerfile]# docker images 
REPOSITORY           TAG           IMAGE ID       CREATED         SIZE
busybox              latest        65ad0d468eb1   15 months ago   4.26MB
15307743762/shuyan   game2048      19299002fdbe   7 years ago     55.5MB
timinglee/game2048   latest        19299002fdbe   7 years ago     55.5MB
timinglee/mario      latest        9a35a9e43e8c   8 years ago     198MB

# 上传镜像
[root@rockynode-1 dockerfile]# docker push 15307743762/shuyan:game2048 
The push refers to repository [docker.io/15307743762/shuyan]
88fca8ae768a: Pushed 
6d7504772167: Pushed 
192e9fad2abc: Pushed 
36e9226e74f8: Pushed 
011b303988d2: Pushed 
game2048: digest: sha256:8a34fb9cb168c420604b6e5d32ca6d412cb0d533a826b313b190535c03fe9390 size: 1364
上传镜像登录信息保存的位置
docker]# vim ~/.docker/config.json 
{
        "auths": {
                "https://index.docker.io/v1/": {
                        "auth": "MTUzMDc3NDM3NjI6eGlhb21pbmcxNDQyLg=="
                }
        }
}

4 搭建docker的私有仓库

4.1 为什么搭建私有仓库

docker hub虽然方便,但是还是有限制

  • 需要internet连接,速度慢

  • 所有人都可以访问

  • 由于安全原因企业不允许将镜像放到外网

好消息是docker公司已经将registry开源,我们可以快速构建企业私有仓库

地址: 

Registry | Docker Docsicon-default.png?t=N7T8https://docs.docker.com/registry/

4.2 搭建简单的Registry仓库

4.2.1 下载Registry镜像

[root@rockynode-1 docker]# docker pull registry
Using default tag: latest
latest: Pulling from library/registry
930bdd4d222e: Pull complete
a15309931e05: Pull complete
6263fb9c821f: Pull complete
86c1d3af3872: Pull complete
a37b1bf6a96f: Pull complete
Digest: sha256:12120425f07de11a1b899e418d4b0ea174c8d4d572d45bdb640f93bc7ca06a3d
Status: Downloaded newer image for registry:latest
docker.io/library/registry:latest

4.2.2 开启Registry

dockerfile]# docker run -d -p 5000:5000 --restart=always --name=registry registry

docker]# docker ps 
CONTAINER ID   IMAGE      COMMAND                   CREATED             STATUS             PORTS                                       NAMES
4581c1f9d4e1   registry   "/entrypoint.sh /etc…"   About an hour ago   Up About an hour   0.0.0.0:5000->5000/tcp, :::5000->5000/tcp   registry

4.2.3 上传镜像到仓库中

dockerfile]# docker tag busybox:latest 192.168.239.10:5000/busybux:latest

dockerfile]# docker images 
REPOSITORY                    TAG           IMAGE ID       CREATED         SIZE
registry                      latest        cfb4d9904335   11 months ago   25.4MB
# 已经成功生成
192.168.239.10:5000/busybux   latest        65ad0d468eb1   15 months ago   4.26MB
busybox                       latest        65ad0d468eb1   15 months ago   4.26MB
15307743762/shuyan            game2048      19299002fdbe   7 years ago     55.5MB
timinglee/game2048            latest        19299002fdbe   7 years ago     55.5MB
timinglee/mario               latest        9a35a9e43e8c   8 years ago     198MB



# docker在上传的过程中默认使用https,但是我们并没有建立https认证需要的认证文件所以会报错
# 所以需要修改他的默认上传的协议为http
dockerfile]# vim /etc/docker/daemon.json 
{
  "registry-mirrors": [
    "https://docker.m.daocloud.io",
    "https://gy3ctkgm.mirror.aliyuncs.com"
  ],
  "insecure-registries": [
    "http://192.168.239.10:5000"
  ]
}

# 上传镜像
[root@rockynode-1 dockerfile]# docker push 192.168.239.10:5000/busybux
Using default tag: latest
The push refers to repository [192.168.239.10:5000/busybux]
d51af96cf93e: Pushed 
latest: digest: sha256:28e01ab32c9dbcbaae96cf0d5b472f22e231d9e603811857b295e61197e40a9b size: 527

# 查看镜像是否上传
docker]# curl 192.168.239.10:5000/v2/_catalog
{"repositories":["busybux"]}

4.4.4 为Registry提加密传输

[root@rockynode-1 certs]# openssl req -newkey rsa:4096 \
-nodes -sha256 -keyout /root/certs/shuyan.key \
-addext "subjectAltName = DNS:reg.shuyan.com" \
-x509 -days 365 -out /root/certs/shuyan.crt

-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:shanxi
Locality Name (eg, city) [Default City]:xian
Organization Name (eg, company) [Default Company Ltd]:docker
Organizational Unit Name (eg, section) []:shuyan
# 注意服务器主机名要和证书内的对得上
Common Name (eg, your name or your server's hostname) []:reg.shuyan.com  
Email Address []:admin@shuyan.com

# 查看证书是否生成
[root@rockynode-1 certs]# ls
shuyan.crt  shuyan.key


# 在docker 客户端,也就是上传镜像的客户端,需要在指定目录下放至证书
# ca证书是由机构颁发的,在客户端需要有证书,在服务端需要有私钥和证书
# 客户端没有证书,所以需要将服务端的证书给客户端拷贝一份
# 在客户端上docker寻找证书是在 /etc/docker/certs.d/reg.shuyan.com/ 寻找的
# 其中 reg.shuyan.com 是服务器的主机名称
[root@rockynode-1 certs]# mkdir -p /etc/docker/certs.d/reg.shuyan.com/
[root@rockynode-1 certs]# cp shuyan.crt /etc/docker/certs.d/reg.shuyan.com/
[root@rockynode-1 certs]# docker images 
REPOSITORY           TAG           IMAGE ID       CREATED         SIZE
15307743762/shuyan   centos7_min   7f2c20fc731e   12 hours ago    210MB
registry             latest        cfb4d9904335   11 months ago   25.4MB
busybox              latest        65ad0d468eb1   15 months ago   4.26MB
15307743762/shuyan   game2048      19299002fdbe   7 years ago     55.5MB
timinglee/game2048   latest        19299002fdbe   7 years ago     55.5MB
timinglee/mario      latest        9a35a9e43e8c   8 years ago     198MB

对服务端做解析

[root@rockynode-1 certs]# vim /etc/hosts 
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.239.10  rockynode-1 reg.shuyan.com                                    
[root@rockynode-1 certs]# docker run --name registry -d -p 443:443 \
--restart=always -v /root/certs:/certs  \   # 将本地证书向docker服务器进行挂载,相当于这个证书是需要放在服务端的
-e REGISTRY_HTTP_ADDR=0.0.0.0:443  \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/shuyan.crt  \ # 指定服务端的的证书路径
-e REGISTRY_HTTP_TLS_KEY=/certs/shuyan.key registry  # 指定服务器的私钥路径

查看镜像是否上传

[root@rockynode-1 certs]# curl -k https://reg.shuyan.com/v2/_catalog
{"repositories":["shuyan"]}

为仓库建立登陆认证

# 安装建立认证文件的工具包
certs]# yum install httpd-tools -y

4.4.5 htpasswd工具 创建用户认证

当我们使用互联网上的托管仓库的时候,在push上传那必然是需要经过密码认证,在私有云虽然没有严格要求说一定要有这个功能,但为了安全起见,私有云也需要具备这样的功能

[root@rockynode-1 ~]# htpasswd -Bc auth/htpasswd shuyan
New password: 
Re-type new password: 
Adding password for user shuyan

1 ~]# docker run --name registry \
           -d \
           -p 443:443 \
           --restart=always \
           -v /root/certs:/certs \
           -e REGISTRY_HTTP_ADDR=0.0.0.0:443 \
           -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/shuyan.crt \
           -e REGISTRY_HTTP_TLS_KEY=/certs/shuyan.key \
           -v /root/auth:/auth \
           -e "REGISTRY_AUTH=htpasswd" \  # 设置服务器认证方式为 htpasswd
           -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
           -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \  # 设置服务器 htpasswd 文件的路径
           registry

811c123000f0ad02fa67bf9d70a0b09957671398a2a0d45716a94775def941ee

认证域 (-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm") 
是在进行 htpasswd 认证时的一个配置选项,
用于定义认证提示信息中显示的文本。
这里的 Registry Realm 是一个字符串,
它会在用户尝试访问需要身份验证的资源时显示给用户。

认证域的作用

当用户尝试访问一个需要身份验证的服务时,
服务器会发送一个 HTTP 401 Unauthorized 响应,
其中包含一个 WWW-Authenticate 头部。
这个头部包含了认证所需的机制(例如 Basic 或 Digest),
以及一个可选的 realm 参数。realm 参数是一个简单的字符串,
用于告知用户他们正在尝试访问的资源的上下文。



[root@rockynode-1 ~]# docker ps 
CONTAINER ID   IMAGE      COMMAND                   CREATED         STATUS         PORTS                                             NAMES
811c123000f0   registry   "/entrypoint.sh /etc…"   4 seconds ago   Up 3 seconds   0.0.0.0:443->443/tcp, :::443->443/tcp, 5000/tcp   registry

尝试不通过登录上传

e-1 ~]# docker tag busybox:latest reg.shuyan.com/shuyan:busybox
e-1 ~]# docker push reg.shuyan.com/shuyan:busybox
The push refers to repository [reg.shuyan.com/shuyan]
d51af96cf93e: Preparing 
no basic auth credentials

进行登录

[root@rockynode-1 ~]# docker login reg.shuyan.com

上传文件

[root@rockynode-1 ~]# docker push reg.shuyan.com/shuyan:busybox

查看上传的文件

 ~]# curl  https://reg.shuyan.com/v2/_catalog -u shuyan:123456 -k
{"repositories":["shuyan"]}

# 退出登录
[root@rockynode-1 ~]# docker logout 
Removing login credentials for https://index.docker.io/v1/

4.3 构建企业级私有仓库

4.3.1 私有仓库之HARBOR

4.3.1.1 HARBOR 的获取

下载软件包地址

HARBOR 获取icon-default.png?t=N7T8https://github.com/goharbor/harbor/releases

4.3.1.2 HARBOR 的介绍

Harbor 是由vmware公司开源的企业级 Docker Registry 项目。

它提供了以下主要功能和特点:

1. 基于角色的访问控制(RBAC):可以为不同的用户和用户组分配不同的权限,增强了安全性和管理的灵活性。

2. 镜像复制:支持在不同的 Harbor 实例之间复制镜像,方便在多个数据中心或环境中分发镜像。

3. 图形化用户界面(UI):提供了直观的 Web 界面,便于管理镜像仓库、项目、用户等。

4. 审计日志:记录了对镜像仓库的各种操作,有助于追踪和审查活动。

5. 垃圾回收:可以清理不再使用的镜像,节省存储空间。

4.3.1.3 部署harbor
[root@rockynode-1 docker-page]# tar xzf harbor-offline-installer-v2.5.4.tgz -C /root
[root@rockynode-1 docker-page]# cd 

[root@rockynode-1 ~]# cd harbor/
[root@rockynode-1 harbor]# ls
common.sh  harbor.v2.5.4.tar.gz  harbor.yml.tmpl  install.sh  LICENSE  prepare

#  harbor.yml 为HARBOR的核心配置文件
[root@rockynode-1 harbor]# cp harbor.yml.tmpl harbor.yml
[root@rockynode-1 harbor]# ls
common.sh             harbor.yml       install.sh  prepare
harbor.v2.5.4.tar.gz  harbor.yml.tmpl  LICENSE

#  修改核心配置文件
[root@rockynode-1 harbor]# vim harbor.yml
harbor_admin_password: 123456        # 设置管理员密码
hostname: reg.shuyan.com             # 设置本机主机名
  certificate: /data/certs/shuyan.crt    # 证书地址
  private_key: /data/certs/shuyan.key    # 私钥地址

# 创建目录存放证书与私钥
[root@rockynode-1 harbor]# mkdir -p /data/certs/

# 由于在构建Registry 私有仓库的时候已经生成过自签名的证书和私钥了,这里直接拷贝
[root@rockynode-1 harbor]# cp ~/certs/* /data/certs/
[root@rockynode-1 harbor]# ls /data/certs/
shuyan.crt  shuyan.key

[root@rockynode-1 harbor]# ./install.sh --help
Please set --with-notary #证书签名
Please set --with-trivy #安全扫描
Please set --with-chartmuseum if needs enable Chartmuseum in Harbor

# 安装 HARBOR 
[root@rockynode-1 harbor]# ./install.sh --with-chartmuseum
[root@rockynode-1 harbor]# ./install.sh --with-chartmuseum

[Step 0]: checking if docker is installed ...

Note: docker version: 27.1.2

[Step 1]: checking docker-compose is installed ...

Note: Docker Compose version v2.29.1

[Step 2]: loading Harbor images ...
Loaded image: goharbor/redis-photon:v2.5.4
Loaded image: goharbor/registry-photon:v2.5.4
Loaded image: goharbor/prepare:v2.5.4
Loaded image: goharbor/harbor-db:v2.5.4
Loaded image: goharbor/harbor-registryctl:v2.5.4
Loaded image: goharbor/trivy-adapter-photon:v2.5.4
Loaded image: goharbor/harbor-portal:v2.5.4
Loaded image: goharbor/harbor-log:v2.5.4
Loaded image: goharbor/harbor-exporter:v2.5.4
Loaded image: goharbor/notary-signer-photon:v2.5.4
Loaded image: goharbor/chartmuseum-photon:v2.5.4
Loaded image: goharbor/harbor-core:v2.5.4
Loaded image: goharbor/harbor-jobservice:v2.5.4
Loaded image: goharbor/nginx-photon:v2.5.4
Loaded image: goharbor/notary-server-photon:v2.5.4


[Step 3]: preparing environment ...

[Step 4]: preparing harbor configs ...
prepare base dir is set to /root/harbor
Clearing the configuration file: /config/portal/nginx.conf
Clearing the configuration file: /config/log/logrotate.conf
Clearing the configuration file: /config/log/rsyslog_docker.conf
Clearing the configuration file: /config/nginx/nginx.conf
Clearing the configuration file: /config/core/env
Clearing the configuration file: /config/core/app.conf
Clearing the configuration file: /config/registry/passwd
Clearing the configuration file: /config/registry/config.yml
Clearing the configuration file: /config/registryctl/env
Clearing the configuration file: /config/registryctl/config.yml
Clearing the configuration file: /config/db/env
Clearing the configuration file: /config/jobservice/env
Clearing the configuration file: /config/jobservice/config.yml
Clearing the configuration file: /config/chartserver/env
Generated configuration file: /config/portal/nginx.conf
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/registryctl/config.yml
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
loaded secret from file: /data/secret/keys/secretkey
Generated configuration file: /config/chartserver/env
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir


Note: stopping existing Harbor instance ...
WARN[0000] /root/harbor/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
[+] Running 6/6
 ✔ Container chartmuseum              Removed                                                                      0.0s 
 ✔ Container harbor-portal            Removed                                                                      0.0s 
 ✔ Container harbor-db                Removed                                                                      0.0s 
 ✔ Container harbor-log               Removed                                                                      0.0s 
 ✔ Network harbor_harbor-chartmuseum  Removed                                                                      0.1s 
 ✔ Network harbor_harbor              Removed                                                                      0.2s 


[Step 5]: starting Harbor ...
WARN[0000] /root/harbor/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
[+] Running 12/12
 ✔ Network harbor_harbor-chartmuseum  Created                                                                      0.1s 
 ✔ Network harbor_harbor              Created                                                                      0.1s 
 ✔ Container harbor-log               Started                                                                      0.6s 
 ✔ Container harbor-portal            Started                                                                      2.0s 
 ✔ Container chartmuseum              Started                                                                      1.9s 
 ✔ Container registry                 Started                                                                      2.2s 
 ✔ Container redis                    Started                                                                      2.5s 
 ✔ Container harbor-db                Started                                                                      2.0s 
 ✔ Container registryctl              Started                                                                      2.5s 
 ✔ Container harbor-core              Started                                                                      3.2s 
 ✔ Container nginx                    Started                                                                      4.0s 
 ✔ Container harbor-jobservice        Started                                                                      4.0s 
✔ ----Harbor has been installed and started successfully.----
[root@rockynode-1 harbor]# docker compose up -d
WARN[0000] /root/harbor/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
[+] Running 10/0
 ✔ Container harbor-log         Running                                                                            0.0s 
 ✔ Container harbor-portal      Running                                                                            0.0s 
 ✔ Container harbor-db          Running                                                                            0.0s 
 ✔ Container redis              Running                                                                            0.0s 
 ✔ Container chartmuseum        Running                                                                            0.0s 
 ✔ Container registry           Running                                                                            0.0s 
 ✔ Container registryctl        Running                                                                            0.0s 
 ✔ Container harbor-core        Running                                                                            0.0s 
 ✔ Container nginx              Running                                                                            0.0s 
 ✔ Container harbor-jobservice  Running                                                                            0.0s 
4.3.1.4 ChartMuseum 参数

在使用 --with-chartmuseum 参数安装 Harbor 时,实际的 Helm Chart 仓库是由 ChartMuseum 提供的。这意味着 ChartMuseum 将作为 Harbor 的一部分来存储和管理 Helm Charts。

当在 Harbor 中上传或管理 Helm Charts 时,实际上是在与 ChartMuseum 交互。ChartMuseum 作为一个独立的服务,被集成到了 Harbor 中,从而使得 Harbor 不仅能够处理 Docker 镜像,还能处理 Helm Charts。

ChartMuseum 在这里扮演的角色是

  • 存储和管理 Helm Charts:ChartMuseum 作为 Harbor 的一部分,负责存储和管理 Helm Charts。
  • 提供 RESTful API 接口:ChartMuseum 提供了一组 API,使用户能够通过 HTTP 请求上传、下载和管理 Charts。
  • 提供 Web 界面:虽然 Harbor 自带了用户界面,但 ChartMuseum 也有自己的 Web 界面,用于浏览和管理 Charts。

因此,在使用 --with-chartmuseum 参数安装 Harbor 时,实际上是在创建一个集成了 ChartMuseum 的 Harbor 实例,以便能够有效地管理 Docker 镜像和 Helm Charts。

4.3.1.5 管理HARBOR

管理harbor的容器:

[root@rockynode-1 harbor]# docker compose stop

[root@rockynode-1 harbor]# docker compose up -d

4.5.1.6 查看镜像加载
[root@rockynode-1 harbor]# docker ps 
CONTAINER ID   IMAGE                                COMMAND                   CREATED          STATUS                    PORTS                                                                            NAMES
22e307ef3685   goharbor/harbor-jobservice:v2.5.4    "/harbor/entrypoint.…"   20 minutes ago   Up 20 minutes (healthy)                                                                                    harbor-jobservice
cc809008c29c   goharbor/nginx-photon:v2.5.4         "nginx -g 'daemon of…"   20 minutes ago   Up 20 minutes (healthy)   0.0.0.0:80->8080/tcp, :::80->8080/tcp, 0.0.0.0:443->8443/tcp, :::443->8443/tcp   nginx
651833856cc2   goharbor/harbor-core:v2.5.4          "/harbor/entrypoint.…"   20 minutes ago   Up 20 minutes (healthy)                                                                                    harbor-core
2ee29ceb1adb   goharbor/registry-photon:v2.5.4      "/home/harbor/entryp…"   20 minutes ago   Up 20 minutes (healthy)                                                                                    registry
501130e2dd88   goharbor/chartmuseum-photon:v2.5.4   "./docker-entrypoint…"   20 minutes ago   Up 20 minutes (healthy)                                                                                    chartmuseum
4ddb26d60dae   goharbor/harbor-db:v2.5.4            "/docker-entrypoint.…"   20 minutes ago   Up 20 minutes (healthy)                                                                                    harbor-db
31283c3a4820   goharbor/harbor-portal:v2.5.4        "nginx -g 'daemon of…"   20 minutes ago   Up 20 minutes (healthy)                                                                                    harbor-portal
c759cff9acb2   goharbor/redis-photon:v2.5.4         "redis-server /etc/r…"   20 minutes ago   Up 20 minutes (healthy)                                                                                    redis
f996e89a2779   goharbor/harbor-registryctl:v2.5.4   "/home/harbor/start.…"   20 minutes ago   Up 20 minutes (healthy)                                                                                    registryctl
8682af8e85a2   goharbor/harbor-log:v2.5.4           "/bin/sh -c /usr/loc…"   20 minutes ago   Up 20 minutes (healthy)   127.0.0.1:1514->10514/tcp    
4.5.1.7 实现效果

~]# docker tag busybox:latest reg.shuyan.com/shuyan/busybox:v5

[root@rockynode-1 ~]# docker push reg.shuyan.com/shuyan/busybox:v5 
The push refers to repository [reg.shuyan.com/shuyan/busybox]
d51af96cf93e: Pushed 
v5: digest: sha256:28e01ab32c9dbcbaae96cf0d5b472f22e231d9e603811857b295e61197e40a9b size: 527

删除打过标签的镜像

[root@rockynode-1 ~]# docker rmi reg.shuyan.com/shuyan/busybox:v5 
Untagged: reg.shuyan.com/shuyan/busybox:v5
Untagged: reg.shuyan.com/shuyan/busybox@sha256:28e01ab32c9dbcbaae96cf0d5b472f22e231d9e603811857b295e61197e40a9b

[root@rockynode-1 ~]# docker rmi reg.shuyan.com/shuyan/nginx_min:v1 
Untagged: reg.shuyan.com/shuyan/nginx_min:v1
Untagged: reg.shuyan.com/shuyan/nginx_min@sha256:bf845e418a24ba511da49449a125742d2358436352ad3fad79af089464027aae

修改配置文件拉取私有仓库镜像

[root@rockynode-1 ~]# vim /etc/docker/daemon.json 

这里增加私有仓库的域名

查看是否加载了此域名

[root@rockynode-1 ~]# docker info

拉取私有仓库镜像

[root@rockynode-1 ~]# docker pull shuyan/nginx_min:v1
v1: Pulling from shuyan/nginx_min
Digest: sha256:bf845e418a24ba511da49449a125742d2358436352ad3fad79af089464027aae
Status: Downloaded newer image for shuyan/nginx_min:v1
docker.io/shuyan/nginx_min:v1

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2082935.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

数据仓库系列11:ETL的主要步骤是什么,它们分别有什么作用?

你是否曾经感觉被海量数据淹没?是否在寻找一种方法来有效地整合、转换和加载这些数据?如果是,那么你来对地方了。今天,我们将深入探讨ETL(Extract, Transform, Load)过程的三个关键步骤,这是每个大数据开发者都应该掌握的核心技能。准备好踏上成为数据整合大师的旅程了吗?让…

Dubbo源码解析之@DubboService、@DubboReference(Dubbo源码一)

更好的阅读体验:Dubbo源码解析之DubboService、DubboReference(Dubbo源码一) 视频讲解:https://www.bilibili.com/video/BV1nBsMejEbL 对于Dubbo用的最多的就是DubboService、DubboReference,与之对应的就是服务的提供…

diskgenuis打开vmdk文件提示读扇区错误

使用DiskGenius_V5_2_x86打开iKuai-0.vmdk 读扇区错误! 磁盘: 起始于 0 扇区 共 1 个扇区。 (Err:0) 读扇区错误! 磁盘: VD0:iKuai-0.vmdk(2GB) 起始于 0 扇区 共 2 个扇区。 (Err:0) 更换官网最新版本 https://www.diskgenius.cn/download.php 可…

一个PPT做3天?有这3个AI做PPT工具再也不发愁!

ppt是什么东西? ppt是英文Powerpoint的缩写,它是微软出品的演示文稿软件,因为其在演示领域的领导地位,也让它成为幻灯片或演示文稿的代名词。 一个完整的ppt,通常包含很多要素,如ppt封面页、ppt目录页、p…

解决Java中Long类型的序列化与JDK8时间的序列化

1.背景 SpringBoot与前端交互 这个场景下Long类型与前端JS交互时会存在精度丢失,根本原因是JS的Number支持不到19位,所以需要后端将Long类型的值转为StringJDK8的时间类 JDK8的时间类比如LocalDateTime、LocalDate 在交互时序列化默认格式是 “yyyy-MM-…

LLM 应用开发入门 - 实现 langchain.js ChatModel 接入火山引擎大模型和实现一个 CLI 聊天机器人(上)

前言 Langchain 是一个大语言模型(LLM)应用开发的框架,提供了 LLM 开发中各个阶段很多非常强大的辅助工具支持。对于进行 LLM 开发是必不可少的工具库。 本文将通过一个实际的开发例子来入门 LLM 开发基础工具链,并实现 langchain.js ChatModel 接入火山引擎大模型和基于…

【Python入门】第4节 函数

📖第4节 函数 ✅函数介绍✅函数的定义✅函数的参数✅函数的返回值🧊None类型的应用场景 ✅函数说明文档✅函数的嵌套调用✅变量的作用域 ✅函数介绍 函数是: 组织好的、可重复使用的、用来实现特定功能的代码段使用函数的好处是:…

erlang学习:用OTP构建系统1

书上案例学习并测试 23.1 通用事件处理 -module(event_handler). %% API -export([make/1, add_handler/2, event/2]).%% 制作一个“什么都不干”的事件处理器Name(一个原子)。这样消息就有地方发送了。 make(Name) ->register(Name, spawn(fun() -…

SpringSpring搭建SpringJdbcTemplateSpring Bean管理Spring结合Mybatis

Spring基础 Spring是什么 Spring是一个轻量级的IOC和AOP的一站式Java开发框架,是为了简化企业级开发而生的 轻量级 框架体积小(核心模块) IOC Inversion Of Control (控制反转)缩写为IOC,是由Spring管理对象,而非传统实现中由程序代码直接操控,将创建对象的控制权反转给s…

8月28日

思维导图 作业&#xff1a; 使用C手动封装一个顺序表&#xff0c;包含成员数组一个&#xff0c;成员变量N个 代码&#xff1a; #include <iostream>using namespace std;using datatype int; #define MAX 30struct SeqList {private:datatype *data;int size 0;int l…

Kafka3.x 使用 KRaft 模式部署 不依赖 ZooKeeper

前言 Kafka 从 2.8.0 版本开始引入了 Kafka Raft Metadata Mode&#xff08;KRaft 模式&#xff09;&#xff0c;这个模式允许 Kafka 在不依赖 ZooKeeper 的情况下进行元数据管理。KRaft 模式在 Kafka 3.0.0 中进入了稳定版本,本文部署的 Kafka_2.12-3.6.0 单机模式 环境 Ce…

Android插件化技术之加载未安装APK

目录 1、概述2、HOOK技术2.1、根据Android9.0系统源码&#xff0c;查看Activity.startActivity(intent,...)的调用流程2.2、根据Android9.0系统源码&#xff0c;查看Context.startActivity(intent,...)的调用流程 3、最终解决方案3.1、实现思路3.2、演示效果 4、最终代码实现4.…

Codeforces Round 968 (Div. 2)

前言 掉大分的一场比赛aaa 原因是 D1 看错条件了一直在想 D2 最后还没想出来。 Standings&#xff1a;6922 题目链接&#xff1a;Dashboard - Codeforces Round 968 (Div. 2) - Codeforces A. Turtle and Good Strings 题意&#xff1a; 给一个字符串&#xff0c;判断是否能把…

AWS CodeCommit 停服,欢迎大家使用极狐GitLab!

2024 年 7 月 25 日&#xff0c;AWS 官方发布公告称&#xff0c;旗下的代码托管服务 AWS CodeCommit 不再接受新用户的注册。这也就意味着用户不得不选择其他同类型产品。 极狐GitLab 为 GitLab 的中国发行版&#xff0c;可以一键私有化部署&#xff0c;详情可查看官网指南。 A…

超实用的8个无版权、免费、高清图片素材网站整理

不管是设计、文章配图&#xff0c;还是视频制作&#xff0c;图片都至关重要。但是图片版权一直都是困扰很多设计、自媒体以及企业的大问题。现在&#xff0c;因为图片侵权被告的案例已经是司空见惯了&#xff0c;有的公众号甚至因为图片版权问题遭受致命打击。 1. Pexels Pexe…

2 Python开发工具:PyCharm的安装和使用

本文是 Python 系列教程第 2 篇&#xff0c;完整系列请查看 Python 专栏。 1 安装 官网下载地址https://www.jetbrains.com.cn/pycharm/&#xff0c;文件比较大&#xff08;约861MB&#xff09;请耐心等待 双击exe安装 安装成功后会有一个30天的试用期。。。本来想放鸡火教程&…

Elastic日志分析

目录 介绍步骤 介绍 Elasticsearch 是在 Apache Lucene 上构建的分布式搜索和分析引擎。Elasticsearch常用于日志分析、全文搜索、安全智能、业务分析和运维智能使用案例。 可以使用 JSON 文档形式或通过 API 等将数据发送到 Elasticsearch。 Elasticsearch 自动存储原始文档…

免杀笔记 ---> CS特性角度看Veh免杀

前一段时间在玩WBGlIl大佬以前发的一篇过卡巴的思路&#xff08;虽然现在不过了&#xff09;&#xff0c;但是在研究的时候发现如果我们我们在没有CS的特性基础下直接看这篇文章&#xff0c;或者说你去魔改他的脚本是不太可能的&#xff0c;刚好就来普及一下这个CS的一些简单特…

胃癌TMEscore的前瞻性临床研究(TME)

目录 ①关于胃癌TME分型介绍 ②TMEscore计算-TMEscore包 ③关于TMEscore的前瞻性研究 ①关于胃癌TME分型介绍 Tumor Microenvironment Characterization in Gastric Cancer Identifies Prognostic and Immunotherapeutically Relevant Gene Signatures - PubMed (nih.gov) …

【Linux —— POSIX信号量 - 基于环形队列的生产消费模型】

Linux —— POSIX信号量 - 基于环形队列的生产消费模型 POSIX信号量信号量的概念POSIX信号量的类型信号量的操作 POSIX信号量函数基于环形队列的生产消费模型设计思路同步和安全性代码 POSIX信号量 信号量的概念 POSIX信号量是一种用于进程和线程之间同步的机制&#xff0c;主…