1 搭建Harbor企业级docker仓库

搭建docker私有仓库是企业在docker使用中必不可少的步骤,harbor是由vmware几个大神开源出来的一款非常优秀的产品。因此今天来讲述一下如何在centos7环境中配置harhor。

1.1 环境准备

1.1.1 安装docker

由于docker已经放在centos7的extra源内,因此可直接使用yum进行安装配置。

1.1.1.1 安装
yum install docker
1.1.1.2 修改docker存储目录

修改配置文件/etc/sysconfig/docker

OPTIONS='--graph=/data/docker --selinux-enabled --log-driver=journald --signature-verification=false'
注:--graph=/data/docker即为修改docker默认路径
1.1.1.3 配置docker镜像加速器

镜像加速器有利于快速下载镜像,修改如下:

[root@node249 tomcat8_jre8_supervisor]# cat /etc/docker/daemon.json
{"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
}
1.1.1.4 启停服务&开机自启动
重新加载配置文件:systemctl daemon-reload
启动:systemctl start docker.service
停止:systemctl stop docker.service
开机自启动:systemctl enable docker.service
1.1.2 安装docker-compose

注:操作系统不自带pip 请自行安装

pip install docker-compose
1.1.3 下载harbor
url地址:https://github.com/goharbor/harbor/releases
选择所需版本。我所下载的为:harbor-online-installer-v1.6.0.tgz
tar -zxf /root/harbor-online-installer-v1.6.0.tgz -C /usr/local/
1.1.4 修改配置文件harbor.cfg
hostname = 192.168.2.46
harbor_admin_password = mvtech123
self_registration = off
project_creation_restriction = adminonly
1.1.5 安装前检查

1.2 安装harbor

[root@harbor ~]# /usr/local/harbor/install.sh [Step 0]: checking installation environment ...Note: docker version: 1.13.1Note: docker-compose version: 1.22.0[Step 1]: preparing environment ...
Clearing the configuration file: ./common/config/adminserver/env
Clearing the configuration file: ./common/config/ui/env
Clearing the configuration file: ./common/config/ui/app.conf
Clearing the configuration file: ./common/config/ui/private_key.pem
Clearing the configuration file: ./common/config/db/env
Clearing the configuration file: ./common/config/jobservice/env
Clearing the configuration file: ./common/config/jobservice/config.yml
Clearing the configuration file: ./common/config/registry/config.yml
Clearing the configuration file: ./common/config/registry/root.crt
Clearing the configuration file: ./common/config/registryctl/env
Clearing the configuration file: ./common/config/registryctl/config.yml
Clearing the configuration file: ./common/config/nginx/nginx.conf
Clearing the configuration file: ./common/config/log/logrotate.conf
loaded secret from file: /data/secretkey
Generated configuration file: ./common/config/nginx/nginx.conf
Generated configuration file: ./common/config/adminserver/env
Generated configuration file: ./common/config/ui/env
Generated configuration file: ./common/config/registry/config.yml
Generated configuration file: ./common/config/db/env
Generated configuration file: ./common/config/jobservice/env
Generated configuration file: ./common/config/jobservice/config.yml
Generated configuration file: ./common/config/log/logrotate.conf
Generated configuration file: ./common/config/registryctl/env
Generated configuration file: ./common/config/ui/app.conf
Generated certificate, key file: ./common/config/ui/private_key.pem, cert file: ./common/config/registry/root.crt
The configuration files are ready, please use docker-compose to start the service.[Step 2]: checking existing instance of Harbor ...[Step 3]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Pulling log (goharbor/harbor-log:v1.6.0)...
Trying to pull repository docker.io/goharbor/harbor-log ...
v1.6.0: Pulling from docker.io/goharbor/harbor-log
51be32cd3c9d: Pull complete
fd9cdcfcef45: Pull complete
4167b797c339: Pull complete
b22d11b0e478: Pull complete
d5aad3df7cee: Pull complete
bd43de1bbd44: Pull complete
7494eff3da48: Pull complete
Digest: sha256:27f9e24f28393a6052b71c93b1571f2269e1d3c489f4081996a099ac88ff56ff
Status: Downloaded newer image for docker.io/goharbor/harbor-log:v1.6.0
Pulling postgresql (goharbor/harbor-db:v1.6.0)...
Trying to pull repository docker.io/goharbor/harbor-db ...
v1.6.0: Pulling from docker.io/goharbor/harbor-db
51be32cd3c9d: Already exists
16bdbb239be8: Pull complete
1f2308455a1a: Pull complete
886c09e06dee: Pull complete
4c74f43fb3f6: Pull complete
a5a85370032d: Pull complete
c393ddbdd7fb: Pull complete
ae546b8414b0: Pull complete
Digest: sha256:ee65d512c93860bd4872be296de80c079842a64e2a4002360e720222a87ec346
Status: Downloaded newer image for docker.io/goharbor/harbor-db:v1.6.0
Pulling redis (goharbor/redis-photon:v1.6.0)...
Trying to pull repository docker.io/goharbor/redis-photon ...
v1.6.0: Pulling from docker.io/goharbor/redis-photon
51be32cd3c9d: Already exists
c400e93ba418: Pull complete
170ae129f67d: Pull complete
bffa31ec55cd: Pull complete
5b72a97a5506: Pull complete
Digest: sha256:4095dc26d6331b4d3c25377bc02d95501c51fbba99f31f9761d321bbc17803af
Status: Downloaded newer image for docker.io/goharbor/redis-photon:v1.6.0
Pulling adminserver (goharbor/harbor-adminserver:v1.6.0)...
Trying to pull repository docker.io/goharbor/harbor-adminserver ...
v1.6.0: Pulling from docker.io/goharbor/harbor-adminserver
51be32cd3c9d: Already exists
a12ecf0fa8fc: Pull complete
3757394ad64f: Pull complete
26ceec7e26ff: Pull complete
e8d90789101d: Pull complete
Digest: sha256:c3ca012c2d69099ba4e3bbedc58ffe146fd10aa5129d44cc7d735edf6167959e
Status: Downloaded newer image for docker.io/goharbor/harbor-adminserver:v1.6.0
Pulling registry (goharbor/registry-photon:v2.6.2-v1.6.0)...
Trying to pull repository docker.io/goharbor/registry-photon ...
v2.6.2-v1.6.0: Pulling from docker.io/goharbor/registry-photon
51be32cd3c9d: Already exists
eaf5637d77d9: Pull complete
c68621c7e44d: Pull complete
314e16c23f49: Pull complete
e3f6c59a8a19: Pull complete
e4f08365b84c: Pull complete
29c822b725fa: Pull complete
Digest: sha256:070dcc29fb5b34cdcc982394ead57f598160fd61bd8daee4b2a5f39ea37bd7a0
Status: Downloaded newer image for docker.io/goharbor/registry-photon:v2.6.2-v1.6.0
Pulling ui (goharbor/harbor-ui:v1.6.0)...
Trying to pull repository docker.io/goharbor/harbor-ui ...
v1.6.0: Pulling from docker.io/goharbor/harbor-ui
51be32cd3c9d: Already exists
ec6a6b245304: Pull complete
a88d6c453ccb: Pull complete
d5e2e9e0086a: Pull complete
f8d7e9d8512c: Pull complete
a06b1a705b19: Pull complete
Digest: sha256:de332db437b8df6ce05203247cbf97ac9f4953672a8c22be8858aee47a0f435f
Status: Downloaded newer image for docker.io/goharbor/harbor-ui:v1.6.0
Pulling jobservice (goharbor/harbor-jobservice:v1.6.0)...
Trying to pull repository docker.io/goharbor/harbor-jobservice ...
v1.6.0: Pulling from docker.io/goharbor/harbor-jobservice
51be32cd3c9d: Already exists
ffcdeda0f50f: Pull complete
e69daf7ff175: Pull complete
840fbfb5576e: Pull complete
Digest: sha256:51d2bf14cd9d1bbf082793a0556ff949937655c67569a86424210a1455f60057
Status: Downloaded newer image for docker.io/goharbor/harbor-jobservice:v1.6.0
Pulling proxy (goharbor/nginx-photon:v1.6.0)...
Trying to pull repository docker.io/goharbor/nginx-photon ...
v1.6.0: Pulling from docker.io/goharbor/nginx-photon
51be32cd3c9d: Already exists
edc138fa5ed7: Pull complete
Digest: sha256:3270c6fc3bdaaecd16280592e916e2cfcf7c5eb54ffc46d79b507b625e3fb4c6
Status: Downloaded newer image for docker.io/goharbor/nginx-photon:v1.6.0
Creating harbor-log ... done
Creating redis              ... done
Creating harbor-adminserver ... done
Creating registry           ... done
Creating harbor-db          ... done
Creating harbor-ui          ... done
Creating harbor-jobservice  ... done
Creating nginx              ... done✔ ----Harbor has been installed and started successfully.----Now you should be able to visit the admin portal at http://192.168.2.46 .
For more details, please visit https://github.com/goharbor/harbor .

1.3 使用harbor

web访问:http://192.168.2.46 客户端若使用harbor仓库则需进行如下配置

#修改配置文件
[root@localhost ~]# cat /etc/docker/daemon.json
{"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"],"insecure-registries": ["192.168.2.46"]
}
#重启docker服务
[root@localhost ~]# systemctl restart docker
1.3.1 push镜像至harbor中
1.3.1.1 登陆

1.3.1.2 push镜像

若为从其他地方pull的镜像需要修改tag

docker tag centos:latest 192.168.2.46/library/centos:latest
docker push 192.168.2.46/library/centos:latest
1.3.2 客户端pull镜像
1.3.2.1 客户端从服务器中拉取镜像
命令如下:docker pull 192.168.2.46/library/zabbix2.4.8:v1.0

1.3.2.2 查看此客户端的镜像

2 使用harbor私有仓库

本章用来介绍私有仓库的使用

2.1 登陆

输入用户名和密码进行登陆

2.2 项目

harbor通过项目管理不同的仓库,用户可以向不同的项目中上传该项目使用的镜像

2.2 日志

日志模块记录harbor的每一步操作,方便查看操作步骤。

2.3 用户管理

本模块来管理用户

2.4 仓库管理

此模块用可以添加一些仓库,用来复制

2.5 复制管理

复制管理可以通过定时任务或立即将本仓库的镜像复制到仓库管理中的仓库中

2.6 配置管理

本模块用来对仓库进行配置管理,例如允许字注册等

转载于:https://www.cnblogs.com/sdhzdtwhm/p/9849760.html

企业级docker私有仓库的配置与使用相关推荐

  1. docker私有仓库harbor配置helm chart仓库(安装helm chart插件)

    harbor配置helm chart仓库 1.harbor 安装的时候 默认没有helm charts的仓库,如果已经安装过重新执行安装即可,不需要prepare docker-compose sto ...

  2. 搭建docker私有仓库 配置用户名密码

    文章目录 1.系统配置 2.搭建服务端 3.配置Windows客户端 4.配置centos客户端 5.查看效果 6.注意点 1.系统配置 服务端:centos 7 客户端:Windows 10 2.搭 ...

  3. 部署docker-consul群集,Harbor构建Docker私有仓库

    文章目录 部署docker-consul群集,Harbor构建Docker私有仓库 了解Harvor 案例概述 Docker consul服务了解 部署Harbor服务过程 不是本地上传镜像操作 在用 ...

  4. Harbor可视化docker私有仓库

    Harbor可视化docker私有仓库 一.Harbor简介 二.Harbor的优势 三.Harbor的结构组件 四.docker私有仓库架构拓扑图 五.部署Harbor私有仓库 六.Harbor维护 ...

  5. Docker私有仓库与Harbor部署使用

    Docker私有仓库与Harbor部署使用 一.本地私有仓库 1. 下载registry镜像 2. 在daemon.json文件中添加私有镜像仓库地址 3. 运行registry容器 4. Docke ...

  6. Docker 私有仓库部署和管理 | Harbor 概述 - 核心组件 - 架构拓扑 | Harbor 构建 Docker 私有仓库实战(理论+实操,超详细!)

    文章目录 一.Docker Harbor 概述 1.Harbor 简介 2.Harbor 的优势 二.Harbor 的核心组件 1.Proxy 2.Registry 3.Core services 4 ...

  7. 使用Harbor构建docker私有仓库

    目录 一.概述 1.什么是Harbor 2.Harbor的优势 3.Docker私有仓库架构 4.Harbor 配置文件以及相关参数 (1)所需参数 (2)可选参数 二.使用Harbor构建docke ...

  8. centos利用nexus搭建局域网docker私有仓库

    centos利用nexus搭建局域网docker私有仓库 1.官网下载nexus oss版本 https://sonatype-download.global.ssl.fastly.net/repos ...

  9. 如何在CentOS 7.x / RHEL 7.x上搭建Docker Private Registry(Docker私有仓库)

    原作者:Pradeep Kumar  转载来源:https://www.linuxtechi.com/setup-docker-private-registry-centos-7-rhel-7/ 如何 ...

最新文章

  1. U-BOOT下使用bootm引导内核方法
  2. 图像分割之(三)从Graph Cut到Grab Cut
  3. Dos下命令运行带有包名的Java类
  4. Oracle 10g、11g :RAC关闭、启动、重启步骤
  5. 技术实践丨React Native 项目 Web 端同构
  6. Circular microphone array 1
  7. 可微信打印的共享服务器哪好,基于微信的图片打印分享平台
  8. 2021国考申论三个月学习计划
  9. 快速非支配排序算法流程
  10. 千里追踪“假疫苗”产销链
  11. 苹果6换屏多钱_苹果手机屏幕碎了怎么办?维修更换要多少钱
  12. 分门别类总结Java中的各种锁,让你彻底记住
  13. MySQL-表的创建
  14. mysql 五舍六入_sql的四舍六入五成双的函数 (1)
  15. 无线设置时服务器无响应怎么办,无线路由器怎么设置服务器未响应
  16. 如何在线免费PDF转换PPT
  17. SQLyog连接linux数据库问题
  18. 太简单!只学十分钟,Python菜鸟也能开发一个区块链客户端
  19. npm install 报错 C:\Program Files\Git\cmd\git.EXE ls-remote -h -t git://github.com/adobe-webplatform解决
  20. #140-(EZOI练习)[进制转换]汽车牌照

热门文章

  1. mysql丢失数据_MySQL数据丢失问题
  2. python开发效率怎样_Python 的开发效率真的比 Java高吗?
  3. python应用题_Python简单应用题
  4. easy excel date 类型解析报错_11.MySQL数据类型
  5. Kotlin入门(11)江湖绝技之特殊函数
  6. C语言中字符串的处理方式
  7. 【git】前端使用git分支的开发流程
  8. 你是“细”精你就赢了 游戏开发者怎样做好玩家细分
  9. SQLPrompt 安装后sql上看不到菜单
  10. 编译安装Apache、php、xcache、FastCGI及相关整合