【harbor】--基础使用

发布于:2025-06-01 ⋅ 阅读:(20) ⋅ 点赞:(0)

推送

不同的管理工具都有说明
在这里插入图片描述

以docker为例

# 第一步--打标签
docker tag SOURCE_IMAGE[:TAG] 192.168.121.201:801/haohao_fist/REPOSITORY[:TAG]
# 第二步--推送
docker push 192.168.121.201:801/haohao_fist/REPOSITORY[:TAG]

默认push推送为https push会失败
在这里插入图片描述

解决办法:在docker/daemon.json中加入推送仓库

[root@localhost harbor]# cat /etc/docker/daemon.json 
{
      "registry-mirrors": [
      "https://docker.m.daocloud.io",
      "https://docker.1ms.run",
      "https://docker-0.unsee.tech",
      "https://docker.hlmirror.com",
      "https://func.ink"
    ],
    "insecure-registries" : [
        "192.168.121.201:801"
    ]
  }
# 重启docker
systemctl restart docker

# harbor可能自己启动不了--官方compose可能有问题(没有去排查了)
# 去到harbor目录下
[root@localhost harbor]# pwd
/haohao/harbor

dokcer compose down
docker compose up -d

# 查看是否启动
docker container ps

以mysql8.0.42为例:

# 登入方式
# 1
docker login 192.168.121.201:801
账户
密码

# 2
docker login -u 账号 -p 密码 192.168.121.201:801

# 3
echo 密码 | docker login -u 账户 --password-stdin 192.168.121.201:801


docker tag mysql:8.0.42 192.168.121.201:801/haohao_first/mysql:v8.0.42

docker push 192.168.121.201:801/haohao_first/mysql:v8.0.42

# 一定要退出 -- 因为在登入的时候 本地保存了一份未加密的 密码 不退出不会销毁
docker logout 192.168.121.201:801

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
注意:一定要logout


网站公告

今日签到

点亮在社区的每一天
去签到