How to Reset the Portainer Admin Password in Docker

Spread the love

Portainer is an advanced container management solution that makes it easier to deploy and manage Docker containers. However, one limitation is that there is no built-in password reset feature for the admin user. If you forget your admin password, you will have to use a helper container to reset it. In this guide, I will walk you through the steps for resetting the Portainer admin password while it is running as a Docker container.

Step 1: Stop the Portainer Container

To reset the admin password, first stop the Portainer container that is currently running. You can achieve this by running the following command:

Bash
docker container stop portainer

This temporarily disables the Portainer container so that you can reset the admin credentials.

Step 2: Run the Password Helper Container

Next, use Portainer’s password reset helper, a temporary container created for this purpose. Make sure you run this helper container with the same bind-mount or volume that Portainer uses for data storage. This will allow the helper to access and change the admin credentials.

Run the following command:

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

Once executed, you should receive a response like this:

Bash
2024/09/12 10:15:48 Password successfully updated for user: admin
2024/09/12 10:15:48 Use the following password to log in: &_4#\3^5V8vLTd)E"NWiJBs26G*9HPl1

This command launches the helper container, resets the admin password, and creates a new password for the admin user.

Step 3: Restart the Portainer Container

After resetting the password, restart the Portainer container to restore its functionality. To start Portainer again, run the following command:

See also  HTTP Error and Status Codes

Bash
docker container start portainer

Step 4: Log In to Portainer

You can now log in to Portainer using the new password provided in Step 2. The default username will be admin, and you’ll enter the newly generated password.

Conclusion

Resetting the admin password in Portainer may appear difficult due to the lack of a dedicated reset feature, but by following the steps outlined above, you will be able to easily regain access to your Portal instance. This process makes use of a helper container to temporarily reset the credentials while keeping your data intact. Following these steps will ensure that your container management system remains operational at all times. Good luck with the containerization!

Leave a Comment