5

Reset docker portainer container password.

 2 years ago
source link: http://i.lckiss.com/?p=6651
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Reset docker portainer container password.

2021-03-21

好记性不如烂笔头~

好久没碰机器上的 docker,上次整理了下 Chrome 的密码,把一些密码转移到了 1Password,还有些删除了,以为没啥用,然后今天才知道本机上的 docker portainer 登录不上了,密码是啥一点印象没有,没有找回密码的选项,本来想干掉重新创建的,搜索了下,还是找到了。

官方开源项目:https://github.com/portainer/helper-reset-password

用法也很简单,关闭 已经在运行的 portainer 容器,找到 portainer 数据卷。

docker inspect portainer

找到 mount 字段,我是直接用的数据卷

运行一个临时容器,把数据卷挂载到官方的重置密码镜像上。

docker run --rm --mount source=portainer_data,target=/data portainer/helper-reset-password

会自动重新生成密码,如果 portainer 是挂载的本地目录,则用 -v 指令即可,比如:

docker run --rm -v path_to_portainer_data:/data portainer/helper-reset-password

密码管理有点麻烦~


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK