Reset Portainer password using command-line.

Pull helper container.

$ docker pull portainer/helper-reset-password
Using default tag: latest
latest: Pulling from portainer/helper-reset-password                                      
c84fbd8dc57e: Pull complete                                                  
add1ab62e3fc: Pull complete
ckDigest: sha256:bbff1847b82ba5aa5c0fdf84408ac8507a4f3feb3ede0fab907a7d5719b1db5d

Status: Downloaded newer image for portainer/helper-reset-password:latest

Identify portainer container.

$ docker ps
16bcda2cdfad   portainer/portainer-ce:latest          "/portainer --sslcer…"   3 weeks ago    Up 2 minutes                      8000/tcp, 9000/tcp,>9443/tcp   portainer

Stop portainer container.

$ docker stop 16bcda2cdfad

Execute helper container to reset password.

$ docker run --rm -v portainer_data:/data portainer/helper-reset-password
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
time="2022-08-24T22:28:13Z" level=info msg="Loading PortainerDB: portainer.db"
time="2022-08-24T22:28:14Z" level=info msg="Opened existing store" version=52
2022/08/24 22:28:14 Password succesfully updated for user: milosz
2022/08/24 22:28:14 Use the following password to login: 4YTs>P#cp3JX5Fj0V)7@l1v*2eaM.9/[

Start portainer container.

$ docker start 16bcda2cdfad

Read more at Portainer documentation - Reset the admin user’s password.