Programming, electronics, lifestyle

03 Jan 2021

Portainer: How to reset password for the Admin user

This article is a copy from the Portainer site. Original isn’t available anymore for unknown reasons, and I made it copy.

Yep, we know, life can be challenging because you forgot or lost your Admin password to access to Portainer. In this help article, you will learn how to do a password reset to the Admin user of Portainer.

Resetting Admin password in Portainer running as container

Reset the password for the Admin user can be accomplished using our reset password container helper.

First, we need to stop our Portainer container. We can do this running:

docker stop "id-portainer-container"

Run the helper with the following command. Be advised that you need to mount the Portainer data volume.

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

If everything works as expected, you will see an output like this:

2020/06/04 00:13:58 Password successfully updated for user: admin
2020/06/04 00:13:58 Use the following password to login: &_4#\3^5V8vLTd)E"NWiJBs26G*9HPl1

Start the Portainer container running and try login with the password generated:

docker start "id-portainer-container"

Resetting Admin password in Portainer running as a stack/service

To reset the password of the Admin user in Portainer running as Stack or Service, we need to scale the Portainer service to zero. To do this, you can run the following:

docker service scale portainer_portainer=0

Run the helper using the same bind-mount/volume for the data volume:

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

If everything works as expected, you will see an output like this:

2020/06/04 00:13:58 Password successfully updated for user: admin
2020/06/04 00:13:58 Use the following password to login: &_4#\3^5V8vLTd)E"NWiJBs26G*9HPl1
Start the Portainer service scaling up and try login with the password generated:
docker service scale portainer_portainer=1