搭建harbor

简介: 通过harbor在线包搭建harbor服务

1、首先安装docker

2、安装docker-compose  docker编排工具

sudocurl-L"https://github.com/docker/compose/releases/download/v2.23.2/docker-compose-$(uname -s)-$(uname -m)"-o /usr/local/bin/docker-compose

其中v2.23.2 为版本号,可自定义版本

3、授权可执行

chmod-X docker-compose

测试:

docker-compose --version

4、下载harbor

wgethttps://github.com/goharbor/harbor/releases/download/v2.9.0/harbor-online-installer-v2.9.0.tgz

tar -zxvf harbor-online-installer-v2.9.0.tgz

cd harbor

可直接下载好,然后导入进去

5、更改配置文件

hostname: 172.20.221.237

# http related config

http:

 # port for http, default is 80. If https enabled, this port will redirect to https port

 port: 8087

# 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

修改配置:hostname

禁用https: 相关

可选修改:密码:harbor_admin_password    

6、生成各个组件的配置

[root@iZm5ejdoz4olqok4sz22dgZ harbor]# ./prepare

此处会拉取镜像并且会创建多个文件夹

7、启动执行harbor

./install.sh

看到表示成功

✔ ----Harbor has been installed and started successfully.----

8、使用docker推送镜像到私有仓库

  • 因为docker 默认支持的是https的请求,搭建的harbor环境是http的所以直接推送会有问题。
  • 需要修改docker的配置文件

ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

修改为:IP为自己实际Ip

ExecStart=/usr/bin/dockerd -H fd:// --insecure-registry=47.105.38.27 --containerd=/run/containerd/containerd.sock

再次使用docker登录

docker login  -u admin -p Harbor12345 http://47.105.38.27:8087

提示:成功

WARNING! Using --password via the CLI is insecure. Use --password-stdin.

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-store

Login Succeeded

9、测试镜像推送

自定义一个自己的镜像,从harbor上复制镜像推送的命令

docker tag SOURCE_IMAGE[:TAG] 172.20.221.237:8087/rdb/REPOSITORY[:TAG]

docker push 172.20.221.237:8087/rdb/REPOSITORY[:TAG]

改为自己的实际镜像及地址:

docker tag ng:my-test 47.105.38.27:8087/rdb/ng:my-test

docker push 47.105.38.27:8087/rdb/ng:my-test


目录
相关文章
|
7月前
|
应用服务中间件 nginx 数据安全/隐私保护
Docker harbor私有仓库部署与管理-1
Docker harbor私有仓库部署与管理
144 0
|
7月前
|
存储 网络安全 数据安全/隐私保护
Docker harbor私有仓库部署与管理-2
Docker harbor私有仓库部署与管理
113 0
|
存储 运维 Kubernetes
在k8s上安装Harbor
在k8s上安装Harbor
590 0
|
25天前
|
存储 安全 数据库
搭建Harbor镜像仓库
搭建Harbor镜像仓库
52 2
|
7月前
|
数据库 数据安全/隐私保护 Docker
Docker harbor私有仓库部署与管理-3
Docker harbor私有仓库部署与管理
110 0
|
4月前
|
Shell Linux 开发工具
搭建自己的Docker Harbor镜像仓库(2)-- 使用篇
搭建自己的Docker Harbor镜像仓库(2)-- 使用篇
124 1
|
8月前
|
Docker 容器
Harbor部署 1
Harbor部署
|
8月前
|
应用服务中间件 nginx Docker
Harbor部署 2
Harbor部署
112 0
|
9月前
|
运维 Kubernetes Cloud Native
搭建Kubord管理k8s/EKS以及Harbor私有仓库教程
Kubernetes(简称k8s)是一个开源的容器编排和管理平台,可以自动化地部署、扩展和管理容器化应用程序。它最初由Google设计并贡献给了Cloud Native Computing Foundation(CNCF),现在是一个非常流行的容器编排平台,支持多种云平台和本地环境。
327 0
|
11月前
|
安全 应用服务中间件 开发工具
Harbor仓库搭建
Harbor仓库搭建
260 0