Reset Grafana password when running in Docker on Raspberry Pi

I am using Grafana in a Docker on a Raspberry Pi but I forgot my password. The ‘forgot password’ option doesn’t work because Grafana is not able to send emails.
Is there any change to reset my password? Otherwise, is it possible to change the SMTP settings in grafana.ini when using Docker?

Hi,

You can use grafana-cli to change the admin password (in versions >4.1). To do this you need to run the command inside of the container using docker exec ....

Docs on resetting your password: http://docs.grafana.org/administration/cli/#reset-admin-password.

Example:

# run docker ps and find out the id of your grafana container
$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                    NAMES
46590b4704b6        grafana/grafana     "/run.sh"           About an hour ago   Up About an hour    0.0.0.0:3000->3000/tcp   reverent_mcclintock

# switch out the id below for the one you got for your container
docker exec -ti 46590b4704b6 grafana-cli admin reset-admin-password --homepath /usr/share/grafana <your new admin password>
3 Likes

Thanks. Was using an old v3 version so I am not able to use the grafana-cli. Just removed v3 en started over again with v4.

Did you try upgrading to v4 with the same database? That should work and allow you to change the password using the cli. Also, I’d recommend upgrading to v5 while you’re at it :slight_smile:

No, did not perform an upgrade, installed a new docker image (https://hub.docker.com/r/fg2it/grafana-armhf/) and removed the old one. I’m quite new with docker, is it possible to upgrade with the same database? Even from 4 to 5?

Grafana has migrations scripts beween different versions so as long as you have the database left it will try to upgrade it. With docker you will have to configure some kind of persistent storage otherwise your data disappears when you remove the container. If you have the old container still you could copy the database out of it using docker cp <cointainer id>:/var/lib/grafana/database.db grafana.db. The easiest way to use it with a new container would be to use a host binding to map it into the container.

There’s some instructions regarding Grafana and docker here and you should also look up the offical docker documentation to read up on volumes and host binds.

Thanks. Looks like clear for me to do a migration from 4 to 5 and storing the database outside of docker.
I’m using Docker on a Raspberry Pi 3, the official docker image is not compatible with the RPI. Any advice which one to use for Grafana 5 on a RPI?

There will be an official container eventually, but in the meantime I would suggest using the docker images supplied by our community member fg2it https://github.com/fg2it/grafana-on-raspberry