Portainer 密码重置
当你的Portainer忘记密码或者密码错误无法登录时候,可以借用 portainer/helper-reset-password 这个容器重置Portainer的管理密码,操作如下:
XML/HTML代码
- # Step 1 Get Portainer ID(查看Portainer容器ID)
- docker ps -a | grep portainer | awk '{print $1}'
- # Step 2 Stop Portainer(停止Portainer)
- docker stop {Portainer_container_id}
- # Step 3 Install "help-reset-password"(拉取密码重置容器镜像)
- docker pull portainer/helper-reset-password
- # Step 4 Get Portainer Data_dir(查看Portainer容器数据保存路径)
- docker inspect {Portainer_container_id}|grep -i "source"
- "Source": "/var/lib/docker/data/portainer"
- # Step 5 reset password(重置Portainer容器密码)
- docker run --rm -v /var/lib/docker/data/portainer:/data portainer/helper-reset-password
- time="2022-12-01T13:52:51Z" level=info msg="Loading PortainerDB: portainer.db"
- time="2022-12-01T13:52:51Z" level=info msg="Opened existing store" version=22
- 2022/12/01 13:52:51 [WARN] Unable to retrieve user with ID 1, will try to create, err: object not found inside the database
- 2022/12/01 13:52:51 Admin user admin successfully created
- 2022/12/01 13:52:51 Use the following password to login: e=/0]-9rdanM4Nj`%rQ8o71Z3S{i!Ia5
- # Step 6 Start Portainer
- docker start {Portainer_container_id}(启动Portainer)
登录Portainer用上面的密码就可以登录,然后修改成自己的密码。
注:{Portainer_container_id} 就是容器的ID,以上命令都要改成自己的容器ID