How to reset the admin password in Portainer running as container

Today I realised that I forgot to document my Portainer password. If you don't know what Portainer is and what it is used for, you should continue here first -> Link

Thank goodness the resetting process is not too time-consuming.

First, you have to determine the container ID.

# List all docker containers
docker ps

Now you can stop the container.

# Stopping the portainer container... 
docker stop <id-portainer-container>

Portainer now offers a resetting tool that can be fetched via the official Docker Hub. Below you will find a command to reset the password right away.

# Resetting the passwort
docker run --rm -v portainer_data:/data portainer/helper-reset-password

Of course, the last thing to do is to start the container again.

# Starting the portainer container
docker start <id-portainer-container>

After you have successfully logged in, you should change your password again.

Source:

https://documentation.portainer.io/v2.0/users/reset-admin/