Skip to content

1. Harbor仓库使用

1.1 登录Web Harbor

1.2 使用

1.1.1 创建用户

1.1.2 创建项目

新建项目,会自动把管理员加入进来

1.1.3 新建成员

1.1.4 推送

  • 登录
#免交互
[root@localhost docker]# docker login -u admin -p Harbor12345 http://hub.xxx.com
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
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

#输入密码
docker login -u admin  http://hub.xxx.com
#免交互
[root@localhost docker]# docker login -u admin -p Harbor12345 http://hub.xxx.com
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
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

#输入密码
docker login -u admin  http://hub.xxx.com
  • 打标签
bash
#pull
docker pull busybox

docker tag beae173ccac6 192.168.177.130/test/busybos:1
#pull
docker pull busybox

docker tag beae173ccac6 192.168.177.130/test/busybos:1
  • 推送
bash
docker push 192.168.177.130/test/busybos:1
The push refers to repository [192.168.177.130/test/busybos]
01fd6df81c8e: Pushed 
1: digest: sha256:62ffc2ed7554e4c6d360bce40bbcf196573dd27c4ce080641a2c59867e732dee size: 527
docker push 192.168.177.130/test/busybos:1
The push refers to repository [192.168.177.130/test/busybos]
01fd6df81c8e: Pushed 
1: digest: sha256:62ffc2ed7554e4c6d360bce40bbcf196573dd27c4ce080641a2c59867e732dee size: 527
  • 查看仓库

1.1.5 重置密码

改回默认密码Harbor12345

sql
update harbor_user set password='a71a7d0df981a61cbb53a97ed8d78f3e', salt='ah3fdh5b7yxepalg9z45bu8zb36sszmr' where username='admin';

#修改加密方式为sha1
update harbor_user set password_version='sha1' where user_id=1;
update harbor_user set password='a71a7d0df981a61cbb53a97ed8d78f3e', salt='ah3fdh5b7yxepalg9z45bu8zb36sszmr' where username='admin';

#修改加密方式为sha1
update harbor_user set password_version='sha1' where user_id=1;
  • 进入容器
docker exec -it harbor-db /bin/bash
docker exec -it harbor-db /bin/bash
  • 连接数据库
psql -h postgresql -d postgres -U postgres #默认密码是:root123 详见 harbor安装配置文件
psql -h postgresql -d postgres -U postgres #默认密码是:root123 详见 harbor安装配置文件
  • 切换数据库
\c registry
\c registry
  • 更新密码
update harbor_user set salt='', password='' where username='admin';
update harbor_user set salt='', password='' where username='admin';
  • 重启容器
docker restart harbor-core
docker restart harbor-core