Harbor镜像仓库安装(http模式)

262 阅读1分钟

harbor官网

http模式不适用与docker生产环境使用,https模式请参考《harbor配置https访问

环境软件版本下载地址备注
系统Centos7.4--
-docker18.09.0-3传送门-
-docker-componse1.24.1传送门-
-harborv1.8.2-rc1传送门

1、安装docker

$ yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine            
$ yum install -y yum-utils device-mapper-persistent-data lvm2
$ yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
$ yum-config-manager --enable docker-ce-edge
$ yum install -y docker-ce-18.09.0-3.el7.x86_64 
$ systemctl start docker
$ systemctl enable docker

2、安装docker-componse

$ curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ chmod +x /usr/local/bin/docker-compose
$ ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
$ docker-compose --version

安装harbor

1、下载harbor

$ wget -c https://storage.googleapis.com/harbor-releases/release-1.8.0/harbor-offline-installer-v1.8.2-rc1.tgz
$ tar zxvf harbor-offline-installer-v1.8.2-rc1.tgz
$ cd harbor

2、配置harbor.yml

$ vim harbor.yml
hostname: #IP地址或域名
http:
	port: 80
harbor_admin_password: xxxxx #  Web端admin用户密码
database:
	password: xxxx
data_volumn: /data

3、安装harbor

$ ./install.sh

4、服务启动完成自动创建nginx和db等容器服务

$ docker-compose ps                                                                                                                                                             
      Name                     Command                  State                        Ports                                                                                                                      
------------------------------------------------------------------------------------------------------------                                                                                                    
harbor-core         /harbor/start.sh                 Up (healthy)                                                                                                                                               
harbor-db           /entrypoint.sh postgres          Up (healthy)   5432/tcp                                                                                                                                    
harbor-jobservice   /harbor/start.sh                 Up                                                                                                                                                         
harbor-log          /bin/sh -c /usr/local/bin/ ...   Up (healthy)   127.0.0.1:1514->10514/tcp                                                                                                                   
harbor-portal       nginx -g daemon off;             Up (healthy)   80/tcp                                                                                                                                      
nginx               nginx -g daemon off;             Up (healthy)   0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp                                                                                                    
redis               docker-entrypoint.sh redis ...   Up             6379/tcp                                                                                                                                    
registry            /entrypoint.sh /etc/regist ...   Up (healthy)   5000/tcp                                                                                                                                    
registryctl         /harbor/start.sh                 Up (healthy)

验证HTTP连接

打开浏览器,然后输入http://harbor.od.com。它应该显示Harbor界面

错误集

Requires: container-selinux >= 2.9
yum 安装的时候如果yum源找不到这个包,更换阿里云的yum源

$ mv /etc/yum.repo.d/CentOS-Base.repo /etc/yum.repo.d/CentOS-Base.repo.bak
$ wget -c -O /etc/yum.repo.d/CentOS-Base.repo http://mirrors.aliyum.com/repo/Centos-7.repo
$ yum install -y container-selinux