harbor的admin密码忘记,重置密码
harbor
Harbor 是一个开源的容器镜像仓库,用于存储和管理 Docker 镜像和其他容器镜像。 * 容器镜像仓库、存储和管理 Docker 镜像和其他容器镜像 * 有什么特点:支持多种镜像格式、易于使用、安全性和访问控制
项目地址:https://gitcode.com/gh_mirrors/ha/harbor
免费下载资源
·
背景:
因harbor镜像仓库长期没有进行维护工作,导致harbor镜像仓库的admin账号的密码忘记了,需要进行重置处理。
admin密码重置过程:
1、登入到db数据库中修改admin密码为初始密码:
登入到harbor-db容器中:
service@harbor:~/harbor$ docker exec -it harbor-db /bin/bash
root [ / ]#
登入到harbor-db的pg数据库服务中:
root [ / ]# psql -h postgresql -d postgres -U postgres
Password for user postgres:
psql (9.6.10)
Type "help" for help.
postgres=#
切换到registry数据库中:
postgres=# \c registry
You are now connected to database "registry" as user "postgres".
查看harbor-user表中admin用户的信息:
registry=# select * from harbor_user where username='admin';
user_id | username | email | password | realname | comment | deleted | reset_uuid | salt | sysadm
in_flag | creation_time | update_time
---------+----------+-------------------+----------------------------------+--------------+------------+---------+------------+----------------------------------+-------
--------+----------------------------+----------------------------
1 | admin | admin@example.com | 694766cd830dd50c98e9229bc4c9f8ea | system admin | admin user | f | | h96f0iyfmiunf8nmioi3lj0l9bkxcmzf | t
| 2019-01-09 05:52:01.245753 | 2021-03-19 02:24:50.109346
(1 row)
重置admin的密码,并退出pg数据库服务和harbor-db容器:
registry=# update harbor_user set salt='', password='' where username='admin';
UPDATE 1
registry-# \q
root [ / ]# exit
2、重新生效harbor服务
这里的重置不会修改harbor的镜像数据的,所以放心的进行重置操作
service@harbor:~/harbor$ docker-compose down
Stopping harbor-portal ... done
Stopping nginx ... done
Stopping harbor-jobservice ... done
Stopping harbor-core ... done
Stopping registryctl ... done
Stopping harbor-db ... done
Stopping registry ... done
Stopping harbor-adminserver ... done
Stopping redis ... done
Stopping harbor-log ... done
Removing harbor-portal ... done
Removing nginx ... done
Removing harbor-jobservice ... done
Removing harbor-core ... done
Creating harbor-log ... done
Removing harbor-db ... done
Removing registry ... done
Removing harbor-adminserver ... done
Removing redis ... done
Creating harbor-db ... done
Creating harbor-core ... done
service@harbor:~/harbor$ docker-compose up -d
Creating harbor-portal ... done
Creating nginx ... done
Creating redis ...
Creating registry ...
Creating harbor-db ...
Creating harbor-adminserver ...
Creating registryctl ...
Creating harbor-core ...
Creating harbor-jobservice ...
Creating harbor-portal ...
Creating nginx ...
service@harbor:~/harbor$ docker-compose ps
Name Command State Ports
------------------------------------------------------------------------------------------------------------------------------
harbor-adminserver /harbor/start.sh Up
harbor-core /harbor/start.sh Up
harbor-db /entrypoint.sh postgres Up 5432/tcp
harbor-jobservice /harbor/start.sh Up
harbor-log /bin/sh -c /usr/local/bin/ ... Up 127.0.0.1:1514->10514/tcp
harbor-portal nginx -g daemon off; Up 80/tcp
nginx nginx -g daemon off; Up 0.0.0.0:443->443/tcp, 0.0.0.0:4443->4443/tcp, 0.0.0.0:80->80/tcp
redis docker-entrypoint.sh redis ... Up 6379/tcp
registry /entrypoint.sh /etc/regist ... Up 5000/tcp
registryctl /harbor/start.sh Up
3、验证harbor服务是否能登入
查看初始化的密码,在harbor的安装目录的harbor.cfg文件中存在的。
service@harbor:~/harbor$ cat harbor.cfg | grep harbor_admin
harbor_admin_password = Harbor12345
大家浏览器界面使用admin/Harbor12345登入:
GitHub 加速计划 / ha / harbor
23.24 K
4.68 K
下载
Harbor 是一个开源的容器镜像仓库,用于存储和管理 Docker 镜像和其他容器镜像。 * 容器镜像仓库、存储和管理 Docker 镜像和其他容器镜像 * 有什么特点:支持多种镜像格式、易于使用、安全性和访问控制
最近提交(Master分支:2 个月前 )
9e55afbb
pull image from registry.goharbor.io instead of dockerhub
Update testcase to support Docker Image Can Be Pulled With Credential
Change gitlab project name when user changed.
Update permissions count and permission count total
Change webhook_endpoint_ui
Signed-off-by: stonezdj <stone.zhang@broadcom.com>
Co-authored-by: Wang Yan <wangyan@vmware.com> 9 天前
3dbfd422
Signed-off-by: wang yan <wangyan@vmware.com> 10 天前
更多推荐
已为社区贡献7条内容
所有评论(0)