当前位置:   article > 正文

docker-compose 搭建Harbor仓库v1.8.1版本--离线安装_docker-compose 1.8

docker-compose 1.8

一、安装准备

harbor下载地址:https://github.com/goharbor/harbor/releases
harbor官方文档:https://github.com/goharbor/harbor/blob/master/docs/installation_guide.md
docker-compose下载地址:https://github.com/docker/compose/releases/
docker-compose官方文档:https://docs.docker.com/compose/install/

环境版本

Centos	7.6.1810
harbor	1.8.1
docker-compose	1.24.1
docker-ce	18.09.7
Openssl	1.0.2
  • 1
  • 2
  • 3
  • 4
  • 5

二、安装openssl

yum install -y openssh-clients
  • 1

查看版本

[root@localhost ~]# openssl version
OpenSSL 1.0.2k-fips  26 Jan 2017
  • 1
  • 2

三、安装docker-ce

docker-ce安装文档:https://blog.csdn.net/qq_39680564/article/details/86545098

四、安装docker-compose

wget https://github.com/docker/compose/releases/download/1.24.1/docker-compose-Linux-x86_64 -O /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
  • 1
  • 2
[root@localhost ~]# docker-compose --version
docker-compose version 1.24.1, build 4667896b
  • 1
  • 2

五、安装harbor

5.1下载安装程序

5.2配置harbor.yml

vim harbor/harbor.yml
  • 1

必填参数,不会改的使用默认就行

wget https://storage.googleapis.com/harbor-releases/release-1.8.0/harbor-offline-installer-v1.8.1.tgz
tar -zxvf harbor-offline-installer-v1.8.1.tgz
  • 1
  • 2

5.2配置harbor.yml

vim harbor/harbor.yml
  • 1

hostname: 192.168.0.222 #主机名,例如:192.168.1.10或reg.yourdomain.com。不要使用localhost或127.0.0.1作为主机名

选填参数

data_volume: /data	#存储harbor数据的位置
harbor_admin_password: Harbor12345	#管理员的初始密码,默认用户名/密码为admin/Harbor12345
database:
	password: root123	#用于db_auth的PostgreSQL数据库的root密码
jobservice:
	max_job_workers: 10	#最大同时工作者数
log:
	level: info	#日志等级,debug, info, warning, error, fatal
	rotate_count: 50
	rotate_size: 200M
	location: /var/log/harbor	#存储日志的目录
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

选填参数

http:
	port: 28083	#http的端口号
https:	#如果启用了公证,则必须设置为https
	port: 443	#https的端口号
	certificate: /your/certificate/path	#SSL证书的路径,仅在协议设置为https时应用
	private_key: /your/private/key/path	#SSL密钥的路径,仅在协议设置为https时应用
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

5.3运行install.sh安装并启动Harbor
执行安装

[root@localhost harbor]# ./install.sh

  • 1
  • 2
[Step 3]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating registryctl ... done
Creating redis       ... done
Creating registry    ... done
Creating harbor-db   ... done
Creating harbor-core ... done
Creating harbor-portal     ... done
Creating harbor-jobservice ... done
Creating nginx             ... done
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

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

Now you should be able to visit the admin portal at http://192.168.0.222.
For more details, please visit https://github.com/goharbor/harbor .

新增 “insecure-registries” : [“192.168.1.40”],harbor地址

5.4 修改配置文件
新增 “insecure-registries” : [“192.168.1.40”],harbor地址

5.4 修改配置文件

vim /etc/docker/daemon.json
  • 1
{
  "data-root":"/home/docker",
  "insecure-registries" : ["192.168.1.40"],
  "registry-mirrors": ["https://1e7waog4.mirror.aliyuncs.com"]
}
  • 1
  • 2
  • 3
  • 4
  • 5

重启docker

systemctl daemon-reload && systemctl restart docker
  • 1

5.5 使用harbor

docker login 192.168.1.40
docker tag SOURCE_IMAGE[:TAG] 192.168.1.40/liuli-dev/IMAGE[:TAG]
docker push 192.168.1.40/liuli-dev/IMAGE[:TAG]
  • 1
  • 2
  • 3

重启harbor

docker-compose up -d
  • 1

关闭habor

docker-compose down
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Li_阴宅/article/detail/802471
推荐阅读
相关标签
  

闽ICP备14008679号