目录

  • podman加速器配置
  • Harbor镜像仓库部署
    • Harbor
    • Harbor简介
    • Harbor的功能
    • Docker compose
    • Harbor部署

podman加速器配置

//配置加速器,不需要重启,立马生效
centos8:
[root@localhost ~]# vi /etc/containers/registries.conf
[[registry]]
prefix="docker.io"
location="arq8p4a6.mirror.aliyuncs.com"centos7:
[root@localhost ~]# vi /etc/containers/registries.conf
[[docker.io]]
location="arq8p4a6.mirror.aliyuncs.com"[root@localhost ~]# cd /etc/containers/
[root@localhost containers]# ls
certs.d  oci  policy.json  registries.conf  registries.conf.d  registries.d  storage.conf
[root@localhost containers]# vi registries.conf
··············
[registries.search]
registries = ["docker.io"]
··············//拉取镜像
[root@localhost ~]# podman pull nginx
Trying to pull docker.io/library/nginx:latest...      //默认找docker.io
Getting image source signatures
Copying blob 21e0df283cd6 done
Copying blob e5ae68f74026 done
Copying blob ed835de16acd done
Copying blob 77700c52c969 done
Copying blob 881ff011f1c9 done
Copying blob 44be98c0fab6 done
Copying config f652ca386e done
Writing manifest to image destination
Storing signatures
f652ca386ed135a4cbe356333e08ef0816f81b2ac8d0619af01e2b256837ed3e

Harbor镜像仓库部署

Harbor

无论是使用Docker-distribution去自建仓库,还是通过官方镜像跑容器的方式去自建仓库,通过前面的演示我们可以发现其是非常的简陋的,还不如直接使用官方的Docker Hub去管理镜像来得方便,至少官方的Docker Hub能够通过web界面来管理镜像,还能在web界面执行搜索,还能基于Dockerfile利用Webhooks和Automated Builds实现自动构建镜像的功能,用户不需要在本地执行docker build,而是把所有build上下文的文件作为一个仓库推送到github上,让Docker Hub可以从github上去pull这些文件来完成自动构建。

但无论官方的Docker Hub有多强大,它毕竟是在国外,所以速度是最大的瓶颈,我们很多时候是不可能去考虑使用官方的仓库的,但是上面说的两种自建仓库方式又十分简陋,不便管理,所以后来就出现了一个被 CNCF 组织青睐的项目,其名为Harbor。

Harbor简介

Harbor是由VMWare在Docker Registry的基础之上进行了二次封装,加进去了很多额外程序,而且提供了一个非常漂亮的web界面。

Harbor是一个开源可信的云原生的仓库项目,用于存储、用户管理和查找镜像。
Harbor通过添加用户通常需要的功能,如安全、身份和管理,扩展了开源Docker分发版。
Harbor支持高级特性,如用户管理、访问控制、活动监视和实例之间的复制。

Harbor的功能

  • 多租户内容签名和验证

  • 安全性和漏洞分析

  • 审计日志记录

  • 身份集成和基于角色的访问控制

  • 实例之间的映像复制

  • 可扩展API和图形UI

  • 国际化(目前为中英文化)

Docker compose

Harbor在物理机上部署是非常难的,而为了简化Harbor的应用,Harbor官方直接把Harbor做成了在容器中运行的应用,而且这个容器在Harbor中依赖类似redis、mysql、pgsql等很多存储系统,所以它需要编排很多容器协同起来工作,因此VMWare Harbor在部署和使用时,需要借助于Docker的单机编排

Compose是一个用于定义和运行多容器Docker应用程序的工具。使用Compose,您可以使用YAML文件来配置应用程序的服务。然后,通过一个命令,您可以创建并启动配置中的所有服务。

Docker Compose官方文档

Harbor部署

Harbor官方文档

//安装Docker compose
[root@localhost ~]# curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
100   664  100   664    0     0    780      0 --:--:-- --:--:-- --:--:--   779
100 12.1M  100 12.1M    0     0  1344k      0  0:00:09  0:00:09 --:--:-- 1747k
[root@localhost ~]# ls /usr/local/bin/
docker-compose//对二进制文件应用可执行权限:
[root@localhost ~]# chmod +x /usr/local/bin/docker-compose
[root@localhost ~]# 

https://github.com/goharbor/harbor/releases/tag/v2.3.5

[root@localhost ~]# ls
anaconda-ks.cfg  harbor-offline-installer-v2.3.5.tgz
[root@localhost ~]# tar xf harbor-offline-installer-v2.3.5.tgz -C /usr/local/
[root@localhost ~]# ls /usr/local/
bin  etc  games  harbor  include  lib  lib64  libexec  sbin  share  src[root@localhost ~]# cd /usr/local/harbor/
[root@localhost harbor]# ls
common.sh  harbor.v2.3.5.tar.gz  harbor.yml.tmpl  install.sh  LICENSE  prepare
[root@localhost harbor]# cp harbor.yml.tmpl harbor.yml
[root@localhost harbor]# ls
common.sh  harbor.v2.3.5.tar.gz  harbor.yml  harbor.yml.tmpl  install.sh  LICENSE  prepare[root@localhost ~]# hostname
localhost.localdomain
[root@localhost ~]# hostname registry.example.com
[root@localhost ~]# vim /etc/hosts
[root@localhost ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.235.172 registry.example.com
//在另一台主机添加域名解析然后ping测试
[root@localhost ~]# vi /etc/hosts
[root@localhost ~]# ping registry.example.com
PING registry.example.com (192.168.235.172) 56(84) bytes of data.
64 bytes from registry.example.com (192.168.235.172): icmp_seq=1 ttl=64 time=1.45 ms
64 bytes from registry.example.com (192.168.235.172): icmp_seq=2 ttl=64 time=1.03 ms
64 bytes from registry.example.com (192.168.235.172): icmp_seq=3 ttl=64 time=0.653 ms
·····················
[root@localhost harbor]# vim harbor.ymlhostname: registry.example.com# http related config
http:# port for http, default is 80. If https enabled, this port will redirect to https portport: 80# https related config
#https:# https port for harbor, default is 443# port: 443# The path of cert and key files for nginx# certificate: /your/certificate/path# private_key: /your/private/key/path
//注释掉以上没注释的
# Remember Change the admin password from UI after launching Harbor.
harbor_admin_password: Harbor12345 #管理员密码  # Harbor DB configuration
database:# The password for the root user of Harbor DB. Change this before any production use.password: root123  #数据库密码# The maximum number of connections in the idle connection pool. If it <=0, no idle connections are retained.max_idle_conns: 100 #最大空闲连接数100
..............................................of harbor.max_open_conns: 900 #最大连接数900# The default data volume
data_volume: /data #数据存放在data
······················//执行
[root@localhost harbor]# ./install.sh
·······················
[Step 5]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating harbor-portal ... done
Creating registryctl   ... done
Creating harbor-db     ... done
Creating registry      ... done
Creating redis         ... done
Creating harbor-core   ... done
Creating harbor-jobservice ... done
Creating nginx             ... done
✔ ----Harbor has been installed and started successfully.----//执行完后多了很多镜像
[root@localhost ~]# docker images
REPOSITORY                      TAG       IMAGE ID       CREATED      SIZE
goharbor/harbor-exporter        v2.3.5    1730c6f650e2   5 days ago   81.9MB
goharbor/chartmuseum-photon     v2.3.5    47004f032938   5 days ago   179MB
goharbor/redis-photon           v2.3.5    3d0cedc89a0d   5 days ago   156MB
goharbor/trivy-adapter-photon   v2.3.5    5c0212e98070   5 days ago   133MB
goharbor/notary-server-photon   v2.3.5    f20a76c65359   5 days ago   111MB
goharbor/notary-signer-photon   v2.3.5    b9fa38eef4d7   5 days ago   108MB
goharbor/harbor-registryctl     v2.3.5    7a52567a76ca   5 days ago   133MB
goharbor/registry-photon        v2.3.5    cf22d3e386b8   5 days ago   82.6MB
goharbor/nginx-photon           v2.3.5    5e3b6d9ce11a   5 days ago   45.7MB
goharbor/harbor-log             v2.3.5    a03e4bc963d6   5 days ago   160MB
goharbor/harbor-jobservice      v2.3.5    2ac32df5a2e0   5 days ago   211MB
goharbor/harbor-core            v2.3.5    23baee01156f   5 days ago   193MB
goharbor/harbor-portal          v2.3.5    bb545cdedf5a   5 days ago   58.9MB
goharbor/harbor-db              v2.3.5    9826c57a5749   5 days ago   221MB
goharbor/prepare                v2.3.5    a1ceaabe47b2   5 days ago   255MB[root@localhost harbor]# ss -antl
State     Recv-Q    Send-Q         Local Address:Port         Peer Address:Port    Process
LISTEN    0         128                127.0.0.1:1514              0.0.0.0:*
LISTEN    0         128                  0.0.0.0:80                0.0.0.0:*
LISTEN    0         128                  0.0.0.0:22                0.0.0.0:*
LISTEN    0         128                     [::]:80                   [::]:*
LISTEN    0         128                     [::]:22                   [::]:*

[root@localhost ~]# vi /etc/docker/daemon.json
[root@localhost ~]# cat /etc/docker/daemon.json
{"insecure-registries": ["registry.example.com"]
}
[root@localhost ~]# systemctl restart docker[root@localhost ~]# docker login registry.example.com
Username: admin
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/#credentials-storeLogin Succeeded//拉取镜像
[root@localhost ~]# docker pull busybox
Using default tag: latest
latest: Pulling from library/busybox
3cb635b06aa2: Pull complete
Digest: sha256:b5cfd4befc119a590ca1a81d6bb0fa1fb19f1fbebd0397f25fae164abe1e8a6a
Status: Downloaded newer image for busybox:latest
docker.io/library/busybox:latest
[root@localhost ~]# docker images
busybox      latest    ffe9d497c324   7 days ago    1.24MB//修改名字
[root@localhost ~]# docker tag busybox:latest registry.example.com/library/busybox:0.1//上传镜像
[root@localhost ~]# docker push registry.example.com/library/busybox:0.1
The push refers to repository [registry.example.com/library/busybox]
64cac9eaf0da: Pushed
0.1: digest: sha256:50e44504ea4f19f141118a8a8868e6c5bb9856efa33f2183f5ccea7ac62aacc9 size: 527
[root@localhost ~]# 

//删除镜像后尝试拉取
[root@localhost ~]# docker rmi registry.example.com/library/busybox:0.1
Untagged: registry.example.com/library/busybox:0.1
Untagged: registry.example.com/library/busybox@sha256:50e44504ea4f19f141118a8a8868e6c5bb9856efa33f2183f5ccea7ac62aacc9
[root@localhost ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
busybox      latest    ffe9d497c324   7 days ago    1.24MB[root@localhost ~]# docker pull registry.example.com/library/busybox:0.1
0.1: Pulling from library/busybox
Digest: sha256:50e44504ea4f19f141118a8a8868e6c5bb9856efa33f2183f5ccea7ac62aacc9
Status: Downloaded newer image for registry.example.com/library/busybox:0.1
registry.example.com/library/busybox:0.1
[root@localhost ~]# docker images
REPOSITORY                             TAG       IMAGE ID       CREATED       SIZE
busybox                                latest    ffe9d497c324   7 days ago    1.24MB
registry.example.com/library/busybox   0.1       ffe9d497c324   7 days ago    1.24MB

使用Harbor的注意事项:

  • 在客户端上传镜像时一定要记得执行docker login进行用户认证,否则无法直接push
  • 在客户端使用的时候如果不是用的https则必须要在客户端的/etc/docker/daemon.json配置文件中配置insecure-registries参数
  • 数据存放路径应在配置文件中配置到一个容量比较充足的共享存储中
  • Harbor是使用docker-compose命令来管理的,如果需要停止Harbor也应用docker-compose stop来停止,其他参数请–help

podman加速器配置Harbor相关推荐

  1. podman加速配置、harbor镜像仓库的部署

    podman加速配置.harbor镜像仓库的部署 1. podman镜像加速配置 2. harbor镜像仓库部署 2.1 harbor简介 2.3 Harbor的功能 2.4 Docker compo ...

  2. harbor镜像仓库-https访问的证书配置 (docker配置harbor https证书)

    harbor镜像仓库-https访问的证书配置 生成CA证书 随便搞个什么文件夹,用于存放生成的证书 创建key文件: root@eb7023:/data/certs>openssl genrs ...

  3. Docker基础(centos安装、阿里云镜像加速器配置、常用命令、数据卷、DockerFile、镜像推送阿里云等)

    Centos 8.1安装Docker 下载docker-ce.repo curl https://download.docker.com/linux/centos/docker-ce.repo -o ...

  4. 安利最全docker加速器配置

    之前写过 docker专栏 https://blog.csdn.net/frdevolcqzyxynjds/category_9967030.html 本篇文章是继 运维之docker启动失败Fail ...

  5. 尚硅谷Docker实战教程-笔记02【安装docker、镜像加速器配置】

    尚硅谷大数据技术-教程-学习路线-笔记汇总表[课程资料下载] 视频地址:尚硅谷Docker实战教程(docker教程天花板)_哔哩哔哩_bilibili 尚硅谷Docker实战教程-笔记01[理念简介 ...

  6. k8s集群之Docker安装镜像加速器配置与k8s容器网络

    安装Docker 参考:https://www.cnblogs.com/rdchenxi/p/10381631.html 加速器配置 参考:https://www.cnblogs.com/rdchen ...

  7. podman加速配置、harbor镜像仓库部署

    podman镜像加速配置 镜像加速可以使用阿里云.清华大学.网易等多个镜像加速,这里我们使用阿里云的镜像加速. 前提需要你先登录,才可以获取你的镜像加速的地址 阿里云镜像加速 // 修改配置文件 ce ...

  8. 记录一次Docker For Windows10镜像加速器配置

    1.访问https://www.daocloud.io 注册账号 2.访问资源->加速器,或者直接访问网址https://www.daocloud.io/mirror,页面中间有加速配置,例如我 ...

  9. Docker镜像加速器配置

    使用Docker拉取镜像时会出现如下错误: 16.04: Pulling from library/ubuntu 22dc81ace0ea: Pulling fs layer 1a8b3c87dba3 ...

  10. Docker的安装及加速器配置

    简介 Docker是一个开源项目 ,其主要目标是实现轻量级的操作系统虚拟化解决方案.Docker的基础是Linux容器(LXC)等技术.在LXC的基础上Docker进行了进一步的封装,让用户不需关心容 ...

最新文章

  1. 比特币现金对穷人更友善
  2. Paxos、ZAB、RAFT协议
  3. 从零写一个编译器(二):语法分析之前置知识
  4. [渝粤教育] 天津城建大学 混凝土结构设计原理A 参考 资料
  5. Mybatis generator(复制粘贴完成)
  6. 【实践驱动开发3-003】TI WL1835MODCOM8 在android的移植 - 软件获取2
  7. cmd杀死MySQL进程命令
  8. java网络爬虫基础学习(二)
  9. Psychological Bulletin:社会认知的层次模型
  10. 数字IC四大岗位分析
  11. web h5调用微信分享功能
  12. 【企业微信SCRM系统】如何通过企业微信接受个人微信好友申请?
  13. c语言学习--计算机软件和硬件
  14. 苹果cmsv10动漫二次元主题网站模板免费源码
  15. 【转载】C语言嵌入式系统编程修炼之二:软件架构篇
  16. 系统光驱盘符不见的解决方法
  17. ICC学习——LAB1
  18. 完整的SEO团队应该包括哪些人员(细分八要职)
  19. 图标设计五条黄金法则
  20. 利用halcon读取tiff图像,并且获取图像指针

热门文章

  1. “正大杯”第十三届全国大学生市场调查与分析大赛(本科模拟题)
  2. linux .cache目录,关于linux系统下的cache Memory
  3. 智能工厂数据采集方案
  4. js设计模式 -- 单例模式
  5. android数据恢复实现,5款免费的Android数据恢复应用
  6. iOS框架引见--媒体层
  7. Open Images Dataset Detection Labels(openimage 检测类别的中文翻译)
  8. 数据流被提前关闭- connectionClosedException:premature end of chunk coded message body:closing chunk expected
  9. iOS应用出现未验证应用的问题排查
  10. js动态时钟,倒计时,去掉数组中重复的元素,抽奖系统随机抽取5名不能重复