【Docker】简易版harbor部署

文章目录

依赖于docker-compose

下载

curl -L "https://github.com/docker/compose/releases/download/2.22.0/docker-compose- ( u n a m e − s ) − (uname -s)- (uname−s)−(uname -m)" -o/usr/local/bin/docker-compose

添加执行权限

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

测试

docker-compose --version

安装harbor

下载

wget https://github.com/goharbor/harbor/releases/download/v2.8.4/harbor-offline-installer-v2.8.4.tgz

解压

tar -zxvf harbor-offline-installer-v2.8.4.tgz

修改配置文件

cd harbor & cp harbor.yml.tmpl harbor.yml & vi harbor.yml

部署

./install.sh

配置开机自启动

docker-compose -f docker-compose.yml up -d

登录验证

使用harbor

登录

docker login 192.168.19.102:8000

打标签

复制代码
docker tag {image name}:{tag} {harbor ip}:{port}/{harbor project}/{image name}:{tag}
# eg
docker tag apache-doris:1.2.6-be 192.168.19.102:8000/doris/apache-doris:1.2.6-be


docker commit container-name {harbor ip}:{port}/{harbor project}/{image name}:{tag}

上传

复制代码
docker push {harbor ip}:{port}/{harbor project}/{image name}:{tag}
# eg
docker push 192.168.19.102:8000/doris/apache-doris:1.2.6-be

下载

复制代码
docker pull {harbor ip}:{port}/{harbor project}/{image name}:{tag}
# eg
docker pull 192.168.19.102:8000/doris/apache-doris:1.2.6-be

常见问题

  • docker login问题:Error response from daemon: Get https://: http: server gave HTTP response to HTTPS client

    复制代码
    # 原因:服务器通过docker login命令登录报错
    
    # 解决方法
    vi /etc/docker/daemon.json
    {
      "insecure-registries": ["192.168.19.102:8000"]
    }
    
    systemctl daemon-reload
    systemctl restart docker
    
    [root@iZuf61frmjzzdoqitgbd9hZ harbor]# docker login 192.168.19.102:8000
    Username: admin
    Password: 
    WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
    Configure a credential helper to remove this warning. See
    https://docs.docker.com/engine/reference/commandline/login/#credentials-store
    
    Login Succeeded
  • k8s无法下载镜像 unauthorized: unauthorized to access repository

    复制代码
    # 创建secret
    kubectl create secret docker-registry harbor-login-registry --docker-email=dd@example --docker-username=admin --docker-password=admin --docker-server=192.168.19.102:8000	
    
    # k8s yaml增加配置
    imagePullSecrets: # 使用密码登录
      - name: harbor-login-registry
相关推荐
Asthenia041232 分钟前
Spring AOP 和 Aware:在Bean实例化后-调用BeanPostProcessor开始工作!在初始化方法执行之前!
后端
Asthenia04121 小时前
什么是消除直接左递归 - 编译原理解析
后端
Asthenia04122 小时前
什么是自上而下分析 - 编译原理剖析
后端
Asthenia04122 小时前
什么是语法分析 - 编译原理基础
后端
Asthenia04122 小时前
理解词法分析与LEX:编译器的守门人
后端
uhakadotcom2 小时前
视频直播与视频点播:基础知识与应用场景
后端·面试·架构
Asthenia04123 小时前
Spring扩展点与工具类获取容器Bean-基于ApplicationContextAware实现非IOC容器中调用IOC的Bean
后端
bobz9653 小时前
ovs patch port 对比 veth pair
后端
Asthenia04124 小时前
Java受检异常与非受检异常分析
后端