zoukankan      html  css  js  c++  java
  • docker私有仓库搭建

    下载docker-compose

    [root@Raygussie ~]# ls /usr/local/bin/
    docker-compose

    给它设置执行权限

    [root@Raygussie ~]# chmod +x /usr/local/bin/docker-compose 

    解压harbor到指定文件夹里

    [root@Raygussie ~]# tar xf harbor-offline-installer-v2.2.0.tgz -C /usr/local/
    [root@Raygussie ~]# ls /usr/local/
    bin  etc  games  harbor  include  lib  lib64  libexec  sbin  share  src

    修改文件

    [root@Raygussie harbor]# vi harbor.yml
    
    //将hostname改为自己的ip地址
    hostname: 192.168.186.130
    
    //把https协议加注释
    # https related config
    #https:
      # https port for harbor, default is 443
      # port: 443
      # The path of cert and key files for nginx
      #certificate: /your/certificate/path
      #private_key: /your/private/key/path
    
    //更改密码
    harbor_admin_password: mfdsg12345
    
    //最下面的代理保持默认,保存退出
    proxy:
      http_proxy:
      https_proxy:
      no_proxy:
      components:
        - core
        - jobservice
        - trivy

    执行安装脚本

    [root@Raygussie harbor]# ./install.sh
    。。。。。。
    Creating network "harbor_harbor" with the default driver
    Creating harbor-log ... done
    Creating harbor-portal ... done
    Creating registry      ... done
    Creating harbor-db     ... done
    Creating redis         ... done
    Creating registryctl   ... done
    Creating harbor-core   ... done
    Creating nginx             ... done
    Creating harbor-jobservice ... done
    ✔ ----Harbor has been installed and started successfully.----

    设置开机自动启动

    [root@Raygussie ~]# vi startall.sh
    
    #!/bin/bash
    
    cd /usr/local/harbor
    docker-compose stop && docker-compose start

    设置执行权限

    [root@Raygussie ~]# chmod +x startall.sh 
    [root@Raygussie harbor]# chmod +x /etc/rc.d/rc.local 
    [root@Raygussie harbor]# ll /etc/rc.d/rc.local 
    -rwxr-xr-x. 1 root root 552 Mar  9 18:56 /etc/rc.d/rc.local

    编辑/etc/rc.d/rc.local

    [root@Raygussie harbor]# vi /etc/rc.d/rc.local 
    
    #!/bin/bash
    /bin/bash /usr/local/harbor/startall.sh

    进入harbor网站,输入用户名密码

    在用户管理里创建用户,填写信息

    设置为管理员

    在项目里创建项目

    在项目里的成员栏里创建用户

    登录仓库拉取镜像

    //打上标记
    [root@Raygussie ~]# docker tag apache:0.1  192.168.186.130/mufeng/apache:0.2
    [root@Raygussie ~]# docker images
    REPOSITORY                      TAG          IMAGE ID       CREATED        SIZE
    192.168.186.130/mufeng/apache   0.2          8d0ca6286efe   32 hours ago   362MB
    
    //上传镜像
    [root@Raygussie ~]# docker push 192.168.186.130/mufeng/apache:0.2
    The push refers to repository [192.168.186.130/mufeng/apache]
    ab2df020f151: Pushed 
    f0e15c2a3878: Pushed 
    65f83255e0ff: Pushed 
    4c6995136b03: Pushed 
    c73ac4df4826: Pushed 
    c04d1437198b: Pushed 
    0.2: digest: sha256:c90b886b2d73dc07a17ea2106ad17454cc0e898e67e86610ee341a8609efc3dd size: 1584

    镜像上传成功

    删除镜像后,拉取镜像

    [root@Raygussie ~]# docker rmi 192.168.186.130/mufeng/apache:0.2
    Error: No such image: 192.168.186.130/mufeng/apache:0.2
    [root@Raygussie ~]# docker pull 192.168.186.130/mufeng/apache:0.2
    0.2: Pulling from mufeng/apache
    Digest: sha256:c90b886b2d73dc07a17ea2106ad17454cc0e898e67e86610ee341a8609efc3dd
    Status: Downloaded newer image for 192.168.186.130/mufeng/apache:0.2
    192.168.186.130/mufeng/apache:0.2
    [root@Raygussie ~]# docker images
    REPOSITORY                      TAG          IMAGE ID       CREATED        SIZE
    192.168.186.130/mufeng/apache   0.2          8d0ca6286efe   32 hours ago   362MB
  • 相关阅读:
    js倒计时的实现
    用Math获取随机数的方法抽奖
    计算器的实现
    放大镜
    关于轮播图,我知道的不多。
    jqery标签页
    jQuery鼠标划入划出
    说说手机页面
    简单说说tab标签页和轮播图
    前端中的那些小事
  • 原文地址:https://www.cnblogs.com/mfdsg/p/14509140.html
Copyright © 2011-2022 走看看