Harbor搭建及配置 问题解决

1.安装harbor
    参考[博客](https://www.cnblogs.com/huangjc/p/6266564.html)
    
    1、下载所需的软件包(以下需要-翻-墙-下载的地方你们自己解决吧......):

        (1)下载docker-compose:
                curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
                chmod +x /usr/local/bin/docker-compose
        (2)下载harbor:

            wget https://github.com/vmware/harbor/releases/download/0.5.0/harbor-offline-installer-0.5.0.tgz
            #我下载的是offline离线包,这样在后续的部署及安装都会比较快,总共有300M左右的大小!
        (3)解压,配置harbor:

            tar zxvf harbor-offline-installer-0.5.0.tgz
            cd harbor/
            
            #vim harbor.cfg
            hostname = 192.168.6.113
            #这里只是简单的测试,所以只编辑这一行,其他的默认不做修改;当然也可以根据你自己的实际情况做修改!
            
        (4)执行安装脚本:

            #会拉取好几个镜像下来,及检查环境:
            
            #./instsll.sh
            Note: docker version: 1.12.5
            Note: docker-compose version: 1.9.0
            
            [Step 0]: checking installation environment ...
            ....
            
            [Step 1]: loading Harbor images ...
            ....
            
            [Step 2]: preparing environment ...
            ....
            
            [Step 3]: checking existing instance of Harbor ...
            ....
            
            [Step 4]: starting Harbor ...
            ....
            
            ✔ ----Harbor has been installed and started successfully.----
            
            Now you should be able to visit the admin portal at http://192.168.6.113. 
            For more details, please visit https://github.com/vmware/harbor .
复制代码
安装完成后会生成如下6个容器:
复制代码

Harbor容器的stop与start:

进入Harbor目录执行如下命令即可:
docker-compose stop/start
复制代码

到此便安装完成了,直接打开浏览器登陆即可:

默认用户密码是:admin/Harbor12345
复制代码

建议使用更新的1.5版本

操作指南参考:

测试登录远程镜像仓库
    docker login ip / domain(有问题未解决)
上传镜像
    先要标记镜像
                 REPOSITOR:TAG   harborDomain/项目名称/镜像名:标签
        docker tag alpine:latest 192.168.242.132/library/alpine:latest
    然后推送镜像
        docker push 192.168.242.132/library/alpine:latest

从Harbor镜像仓库拉取镜像到客户端
    先将客户端的已有镜像删除
        docker rmi 11cd0b38bc3c
    然后使用命令拉取镜像
        docker pull 192.168.242.132/library/alpine:latest
    最后查看镜像,拉取成功。
        docker images

复制代码

问题及解决

登录到远程镜像仓库(用ip)
    Error response from daemon: Get https://172.20.48.93/v2/: 
    dial tcp 172.20.48.93:443: getsockopt: connection refused
    
解决方法:
    1.修改docker配置文件
        sudo vim /etc/default/docker
        添加DOCKER_OPTS="--insecure-registry 172.20.48.93"
    2.重启docker
        sudo service docker restart
    3.重新登录
        docker login ip
    4.上传下拉镜像
        docker push ip/项目名/镜像名:标签
复制代码

待解决,用域名还是会报错
    Error response from daemon: Get https://harbor.local.com/v2/: 
    dial tcp 172.20.48.93:443: getsockopt: connection refused复制代码

转载于:https://juejin.im/post/5befe769e51d457b2f12c26d

你可能感兴趣的:(Harbor搭建及配置 问题解决)