Harbor安装

Harbor安装

Harbor是一个开源的镜像仓库.

harbor官网

环境 软件 版本 下载地址 备注
系统 Centos 7.4 - -
- docker 18.09.0-3 传送门 -
- docker-componse 1.24.1 传送门 -
- harbor v1.8.2-rc1 传送门

安装环境

安装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
如果遇到错误

安装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
docker-compose version 1.24.1, build 1110ad01

安装harbor

下载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

配置harbor.yml

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

安装harbor

$ ./install.sh

服务启动完成自动创建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)

登陆界面
Harbor安装_第1张图片

harbor使用

# 使用前先登录
$ docker login XXX.XXX.XXX.XXX
Username: 
Password: 
Login Succeeded
# 上传之前先打tag
docker pull k8s.gcr.io/kubernetes-dashboard
docker tag k8s.gcr.io/kubernetes-dashboard XXX.XXX.XXX.XXX/library/k8s.gcr.io/kubernetes-dashboard
# 上传镜像
docker push XXX.XXX.XXX.XXX/library/k8s.gcr.io/kubernetes-dashboard
# 下载镜像
docker pull XXX.XXX.XXX.XXX/library/k8s.gcr.io/kubernetes-dashboard

错误集

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

你可能感兴趣的:(kubernetes)