安装harbor

先安装docker:http://www.cnblogs.com/cjsblogs/p/8717304.html

 

1、下载指定版本的docker-compose

curl -L https://github.com/docker/compose/releases/download/1.21.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

  

2、对二进制文件赋可执行权限

sudo chmod +x /usr/local/bin/docker-compose

  

3、测试下docker-compose是否安装成功

docker-compose --version

  

4、Harbor 服务搭建
离线安装包

wget https://storage.googleapis.com/harbor-releases/release-1.4.0/harbor-offline-installer-v1.4.0.tgz
tar -xvf harbor-offline-installer-v1.4.0.tgz
cd harbor

修改harbor.cfg
#vim harbor.cfg
hostname = 宿主机ip
ssl_cert = /data/harbor/cert/server.crt
ssl_cert_key = /data/harbor/cert/server.key
secretkey_path = /data/harbor

修改docker-compose.yml
#vimdocker-compose.yml
version: '2'
services:
  log:
    image: vmware/harbor-log:v1.4.0
    container_name: harbor-log 
    restart: always
    volumes:
      - /var/log/harbor/:/var/log/docker/:z
      - ./common/config/log/:/etc/logrotate.d/:z
    ports:
      - 127.0.0.1:1514:10514
    networks:
      - harbor
  registry:
    image: vmware/registry-photon:v2.6.2-v1.4.0
    container_name: registry
    restart: always
    volumes:
      - /data/harbor/registry:/storage:z
      - ./common/config/registry/:/etc/registry/:z
    networks:
      - harbor
    environment:
      - GODEBUG=netdns=cgo
    command:
      ["serve", "/etc/registry/config.yml"]
    depends_on:
      - log
    logging:
      driver: "syslog"
      options:  
        syslog-address: "tcp://127.0.0.1:1514"
        tag: "registry"
  mysql:
    image: vmware/harbor-db:v1.4.0
    container_name: harbor-db
    restart: always
    volumes:
      - /data/harbor/database:/var/lib/mysql:z
    networks:
      - harbor
    env_file:
      - ./common/config/db/env
    depends_on:
      - log
    logging:
      driver: "syslog"
      options:  
        syslog-address: "tcp://127.0.0.1:1514"
        tag: "mysql"
  adminserver:
    image: vmware/harbor-adminserver:v1.4.0
    container_name: harbor-adminserver
    env_file:
      - ./common/config/adminserver/env
    restart: always
    volumes:
      - /data/harbor/config/:/etc/adminserver/config/:z
      - /data/harbor/secretkey:/etc/adminserver/key:z
      - /data/harbor/:/data/harbor/:z
    networks:
      - harbor
    depends_on:
      - log
    logging:
      driver: "syslog"
      options:  
        syslog-address: "tcp://127.0.0.1:1514"
        tag: "adminserver"
  ui:
    image: vmware/harbor-ui:v1.4.0
    container_name: harbor-ui
    env_file:
      - ./common/config/ui/env
    restart: always
    volumes:
      - ./common/config/ui/app.conf:/etc/ui/app.conf:z
      - ./common/config/ui/private_key.pem:/etc/ui/private_key.pem:z
      - ./common/config/ui/certificates/:/etc/ui/certificates/:z
      - /data/harbor/secretkey:/etc/ui/key:z
      - /data/harbor/ca_download/:/etc/ui/ca/:z
      - /data/harbor/psc/:/etc/ui/token/:z
    networks:
      - harbor
    depends_on:
      - log
      - adminserver
      - registry
    logging:
      driver: "syslog"
      options:  
        syslog-address: "tcp://127.0.0.1:1514"
        tag: "ui"
  jobservice:
    image: vmware/harbor-jobservice:v1.4.0
    container_name: harbor-jobservice
    env_file:
      - ./common/config/jobservice/env
    restart: always
    volumes:
      - /data/harbor/job_logs:/var/log/jobs:z
      - ./common/config/jobservice/app.conf:/etc/jobservice/app.conf:z
      - /data/harbor/secretkey:/etc/jobservice/key:z
    networks:
      - harbor
    depends_on:
      - ui
      - adminserver
    logging:
      driver: "syslog"
      options:  
        syslog-address: "tcp://127.0.0.1:1514"
        tag: "jobservice"
  proxy:
    image: vmware/nginx-photon:v1.4.0
    container_name: nginx
    restart: always
    volumes:
      - ./common/config/nginx:/etc/nginx:z
    networks:
      - harbor
    ports:
      - 80:80
      - 443:443
      - 4443:4443
    depends_on:
      - mysql
      - registry
      - ui
      - log
    logging:
      driver: "syslog"
      options:  
        syslog-address: "tcp://127.0.0.1:1514"
        tag: "proxy"
networks:
  harbor:
    external: false
	
启动安装;
./install.sh

 

修改docker配置文件:

--insecure-registry ip

 

重启docker:

systemctl daemon-reload
systemctl restart docker

  

应用检查:

 

 应用配置:

登录http://ip

 

 

 新建项目:

 

5、推送镜像

登录宿主机

#ssh xxx@ip

登录仓库:

#docker login http://ip

推送镜像:

docker push ip/base/jdk:8u121

 

PS:如果开启防火墙记得开通相关端口

 

 

posted @ 2018-04-16 15:17  风子陈  阅读(263)  评论(0编辑  收藏  举报