欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

搭建harbor docker仓库

程序员文章站 2022-04-03 21:16:41
...

安装和配置Harbor

1、安装docker并启动

#yum install -y yum-utils   device-mapper-persistent-data   lvm2
# ls
container-selinux-2.21-1.el7.noarch.rpm
docker-ce-18.06.1.ce-3.el7.x86_64.rpm
libsemanage-2.5-8.el7.x86_64.rpm
libsemanage-python-2.5-8.el7.x86_64.rpm
pigz-2.3.4-1.el7.x86_64.rpm
policycoreutils-2.5-17.1.el7.x86_64.rpm
policycoreutils-python-2.5-17.1.el7.x86_64.rpm
#yum install * -y
# systemctl start docker.service

2、安装docker-compose

# curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
# chmod +x /usr/local/bin/docker-compose
# curl -L https://raw.githubusercontent.com/docker/compose/1.16.1/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose

测试是否安装成功:

# docker-compose --version
docker-compose version 1.16.1, build 6d1ac21

3、安装Harbor

# wget -P /usr/loca/src/     https://github.com/vmware/harbor/releases/download/v1.2.0/harbor-online-installer-v1.2.0.tgz
# cd /usr/loca/src/
# tar zxf harbor-online-installer-v1.2.0.tgz  -C /usr/local/
# cd /usr/local/harbor/

4、编辑配置文件

# vim /usr/local/harbor/harbor.cfg
hostname = rgs.unixfbi.com
#邮箱配置
email_server = smtp.qq.com
email_server_port = 25
email_username = aaa@qq.com
email_password =12345678
email_from = UnixFBI <aaa@qq.com>
email_ssl = false
#禁止用户注册
self_registration = off
#设置只有管理员可以创建项目
project_creation_restriction = adminonly

5、执行安装脚本

# /usr/local/harbor/install.sh

安装过程如图所示:
搭建harbor docker仓库

6、Harbor的启动和停止命令

启动Harbor
# docker-compose start
停止Harbor
# docker-comose stop
重启Harbor
# docker-compose restart

搭建harbor docker仓库

7、访问测试

浏览器访问本机IP

搭建harbor docker仓库

  • 默认账号密码: admin / Harbor12345 登录后修改密码

搭建harbor docker仓库