0


【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-reloadsystemctl restart docker[root@iZuf61frmjzzdoqitgbd9hZ harbor]# docker login 192.168.19.102:8000Username: adminPassword: WARNING! Your password will be stored unencrypted in /root/.docker/config.json.Configure a credential helper to remove this warning. Seehttps://docs.docker.com/engine/reference/commandline/login/#credentials-storeLogin Succeeded
  • k8s无法下载镜像 unauthorized: unauthorized to access repository# 创建secretkubectl 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
标签: docker 容器 运维

本文转载自: https://blog.csdn.net/al6nlee/article/details/133691035
版权归原作者 Al6n Lee 所有, 如有侵权,请联系我们删除。

“【Docker】简易版harbor部署”的评论:

还没有评论