Docker 개인 창고 Harbor v1.6.1 설치

7045 단어
  • 환경
  •   : CentOS 7.5.1804
      : 4.18.7-1.el7.elrepo.x86_64
    
    Docker-ce 18.09
    docker-compose 1.23.1
    Harbor v1.6.1
    Harbor  IP:192.168.1.3
    
    Docker            HTTPS  。
          ,            。
    
    !!!      SELINUX!!!
    
  • Docker 및 docker-compose 설치
  • #  Docker
    wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    
    yum install -y docker-ce
    
    mkdir /etc/docker/
    cat << EOF > /etc/docker/daemon.json
    {   "registry-mirrors": ["https://registry.docker-cn.com"],
        "live-restore": true,
        "default-shm-size": "128M",
        "max-concurrent-downloads": 10,
        "oom-score-adjust": -1000,
        "debug": false
    }   
    EOF
    
    #         
    cat <  /etc/sysctl.d/docker.conf
    net.bridge.bridge-nf-call-ip6tables = 1
    net.bridge.bridge-nf-call-iptables = 1
    EOF
    
    sysctl --system
    
    #  docker-compose
    yum install -y python-pip
    pip install docker-compose
    
    systemctl daemon-reload
    systemctl enable docker
    systemctl restart docker
    
    ###############################################
    [root@harbor ~]# docker -v
    Docker version 18.09.0, build 4d60db4
    
    [root@harbor ~]# docker-compose -v
    docker-compose version 1.23.1, build b02f130
    
  • Harbor 다운로드
  • #    :https://github.com/goharbor/harbor/releases
    #  online ,        
    cd $HOME
    wget https://storage.googleapis.com/harbor-releases/harbor-online-installer-v1.6.1.tgz
    
    #  
    tar -xf harbor-online-installer-v1.6.1.tgz
    cd harbor
    
    [root@harbor ~]# cd harbor/
    [root@harbor harbor]# ll
    total 1588
    drwxr-xr-x 3 root root      23 Nov 13 15:03 common
    -rw-r--r-- 1 root root     727 Nov  9 13:59 docker-compose.chartmuseum.yml
    -rw-r--r-- 1 root root     777 Nov  9 13:59 docker-compose.clair.yml
    -rw-r--r-- 1 root root    1258 Nov  9 13:59 docker-compose.notary.yml
    -rw-r--r-- 1 root root    3589 Nov  9 13:59 docker-compose.yml
    drwxr-xr-x 3 root root     136 Nov  9 13:59 ha
    -rw-r--r-- 1 root root    7913 Nov  9 13:59 harbor.cfg
    -rwxr-xr-x 1 root root    6162 Nov  9 13:59 install.sh
    -rw-r--r-- 1 root root   10768 Nov  9 13:59 LICENSE
    -rw-r--r-- 1 root root     482 Nov  9 13:59 NOTICE
    -rw-r--r-- 1 root root 1535603 Nov  9 13:59 open_source_license
    -rwxr-xr-x 1 root root   39496 Nov  9 13:59 prepare
    
    #######################################################
    harbor.cfg               #   harbor      
    install.sh               #    
    docker-compose.yml       #docker-compose    
    
  • Harbor를 수정합니다.cfg 파일
  • #      :https://github.com/goharbor/harbor/blob/master/docs/installation_guide.md#configuring-harbor
    
    #          :
    
    #hostname      ,    ip、  ,      127.0.0.1 localhost
    hostname = registry.lotbrick.com
    
    #    ,   http,     https
    #     HTTPS,                 ssl  ,    docker    ssl  ,    
    #      HTTP,    daemon.json     :insecure-registries  , docker         http  
    ui_url_protocol = https
    
    #  Harbor ,   UI     ,   Harbor12345
    harbor_admin_password = Harbor12345
    
    #           
    max_job_workers = 3 
    
    #SSL     ,       https   ,     
    ssl_cert = /data/cert/server.crt
    ssl_cert_key = /data/cert/server.key
    
    #      , :       
    secretkey_path = /data
    
    #    ,           
    email_identity = 
    email_server = smtp.mydomain.com
    email_server_port = 25
    email_username = [email protected]
    email_password = abc
    email_from = admin 
    email_ssl = false
    
    #    ,          , LADP、    、     。   db_auth,mysql     
    auth_mode = db_auth
    
    #       
    self_registration = on
    
    #Token    ,  30  
    token_expiration = 30
    
    #          ,   everyone(   ),      adminonly(     )
    project_creation_restriction = everyone
    
  • Harbor 설치
  • #            /data/cert   
    
    mkdir -pv /data/cert
    
    ####################################################################
    [root@harbor cert]# pwd
    /data/cert
    [root@harbor cert]# ll
    total 8
    -rw-r--r-- 1 root root 3575 Nov 10 14:43 server.crt
    -rw-r--r-- 1 root root 1675 Nov 10 14:43 server.key
    [root@harbor cert]#
    
    #  install.sh  
    
    cd $HOME/harbor
    docker-compose pull
    ./install.sh
    
    docker ps -a
    
    #  harbor   ,          up   
    [root@harbor harbor]# docker ps -a
    CONTAINER ID        IMAGE                                    COMMAND                  CREATED              STATUS                        PORTS                                                              NAMES
    1949a6ca748c        goharbor/harbor-jobservice:v1.6.1        "/harbor/start.sh"       About a minute ago   Up About a minute                                                                                harbor-jobservice
    162f83595512        goharbor/nginx-photon:v1.6.1             "nginx -g 'daemon of…"   About a minute ago   Up About a minute (healthy)   0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:4443->4443/tcp   nginx
    46049917eebc        goharbor/harbor-ui:v1.6.1                "/harbor/start.sh"       About a minute ago   Up About a minute (healthy)                                                                      harbor-ui
    d53e5cf18b05        goharbor/redis-photon:v1.6.1             "docker-entrypoint.s…"   2 minutes ago        Up About a minute             6379/tcp                                                           redis
    7f33cfd0d7ee        goharbor/harbor-adminserver:v1.6.1       "/harbor/start.sh"       2 minutes ago        Up About a minute (healthy)                                                                      harbor-adminserver
    585f5fd7886d        goharbor/registry-photon:v2.6.2-v1.6.1   "/entrypoint.sh /etc…"   2 minutes ago        Up About a minute (healthy)   5000/tcp                                                           registry
    7f6f7925306d        goharbor/harbor-db:v1.6.1                "/entrypoint.sh post…"   2 minutes ago        Up About a minute (healthy)   5432/tcp                                                           harbor-db
    927fd00420fe        goharbor/harbor-log:v1.6.1               "/bin/sh -c /usr/loc…"   2 minutes ago        Up About a minute (healthy)   127.0.0.1:1514->10514/tcp                                          harbor-log
    [root@harbor harbor]#
    
  • 웹 페이지 구성
  • #  windows hosts  , registry.lotbrick.com   harbor   IP
    #         
    #     :admin,   :Harbor12345
    #        test     
  • 테스트 이미지를 창고에 업로드
  • #  harbor   hosts, harbor     
    cat << EOF >> /etc/hosts
    192.168.1.3  registry.lotbrick.com
    EOF
    
    #pull  alpine    
    docker pull alpine
    docker images
    
    #  alpine   tag
    #      :    /   /   :  
    docker tag alpine:latest registry.lotbrick.com/test/alpine:latest
    
    #         
    docker login registry.lotbrick.com
    docker push registry.lotbrick.com/test/alpine:latest
    
    #  web  ,          
  • 교환기 시험pull 렌즈
  • #  ,     hosts  
    cat << EOF >> /etc/hosts
    192.168.1.3  registry.lotbrick.com
    EOF
    
    #  pull
    docker pull registry.lotbrick.com/test/alpine:latest
    

    전재 대상:https://blog.51cto.com/bigboss/2316525

    좋은 웹페이지 즐겨찾기