Harbor 安装
Posted lixinliang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Harbor 安装相关的知识,希望对你有一定的参考价值。
安装docker环境 # Uninstall old versions yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine # Install using the repository 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 install docker-ce docker-ce-cli containerd.io -y # Boot the service systemctl start docker systemctl enable docker
安装docker-compos yum install docker-compose -y 或者 curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/bin/docker-compose chmod +x /usr/bin/docker-compose
安装harbor GitHub # wget https://storage.googleapis.com/harbor-releases/release-1.8.0/harbor-offline-installer-v1.8.0.tgz # tar zxvf harbor-offline-installer-v1.8.0.tgz # cd harbor # vi harbor.yml //修改hostname为当前主机IP # ./prepare //预处理 # ./install.sh //执行安装操作 # docker ps //harbor正常启动的容器组件,nginx,jobserver,ui,redis,registry,db,log
浏览器访问 user:admin passwd:Harbor12345 密码保存在harbor.cfg配置文件中
docker配置 # vi /usr/lib/systemd/system/docker.service ExecStart=/usr/bin/dockerd --insecure-registry g-registry01.bjyztj.sjhl # systemctl daemon-reload # systemctl restart docker # docker tag nginx:latest g-registry01.bjyztj.sjhl/test/nginx:mytest # docker push g-registry01.bjyztj.sjhl/test/nginx:mytest # docker pull g-registry01.bjyztj.sjhl/test/nginx:mytest
启用https https模式需要启用域名解析 mkdir /data/cert -p cd /data/cert openssl genrsa -out /data/cert/ca_harbor.key 2048 openssl req -x509 -new -nodes -key /data/cert/ca_harbor.key -subj "/CN=g-registry01.bjyztj.sjhl" -days 5000 -out /data/cert/ca_harbor.crt openssl req -x509 -new -nodes -key /data/cert/ca_harbor.key -subj "/CN=g-registry02.bjyztj.sjhl" -days 5000 -out /data/cert/ca_harbor.crt
cd ~/harbor # vi harbor.yml -------------------------------------------- hostname: g-registry01.bjyztj.sjhl # https related config https: # # https port for harbor, default is 443 port: 443 # # The path of cert and key files for nginx certificate: /data/cert/ca_harbor.crt private_key: /data/cert/ca_harbor.key
cd ~/harbor docker-compose down ./install.sh
以上是关于Harbor 安装的主要内容,如果未能解决你的问题,请参考以下文章