111111

docker-安装harbor

一。安装docker 上传harbor zip包并安装

unzip harbor.zip 
tar -xvf harbor-offline-installer-v2.0.0.tgz
cp harbor.yml.tmpl harbor.yml
vim harbor.yml   #修改主机地址为本地
./prepare  #如果报错看docker是否启动 没启动启动docker

  scp  docker-compose-Linux-x86_64 172.17.17.84:/usr/bin/

  mv /usr/bin/docker-compose-Linux-x86_64 /usr/bin/docker-compose

 chmod + x  /usr/bin/docker-compose

./install.sh

http://172.17.17.84/harbor/projects      登录页面  账号admin  密码Harbor12345 成功

新建项目 tomcat

 

二。开启https访问并设置证书

/data/harbor/harbor.yml

https:
  # https port for harbor, default is 443
  port: 443
  # The path of cert and key files for nginx
  certificate: /root/ssl/reg.ctnrs.com.pem
  private_key: /root/ssl/reg.ctnrs.com-key.pem

2.1  上传证书

   yum install wget -y

sh  certs.sh
sh  cfssl.sh
./prepare
docker-compose down
docker-compose up –d
mkdir /etc/docker/certs.d/reg.ctnrs.com -p
 
2.2 将数字证书复制到Docker主机
mkdir /etc/docker/certs.d/reg.ctnrs.com -p
scp /root/ssl/reg.ctnrs.com.pem  172.17.17.85:/etc/docker/certs.d/reg.ctnrs.com/reg.ctnrs.com.crt        #把证书拷贝到要上传harbor的docker主机上并改名字
docker pull reg.ctnrs.com/tomcat/tomcat:v1     #下载harbor里的镜像   镜像随意

 

 2.3推送需要先登录harbor

docker login reg.ctnrs.com

账号   admin 

密码   harbor12345

docker tag lizhenliang/java-demo  reg.ctnrs.com/tomcat/tomcat:v1              打镜像

docker push reg.ctnrs.com/tomcat/tomcat:v1   #推送打好的tag镜像

 

posted @ 2020-08-24 16:46  赵SIR  阅读(1752)  评论(0编辑  收藏  举报