September 14, 2020

Reset Grafana admin password in container

I came across this handy article1 today while attempting to resolve the very issue in the title. Short, unambiguous, and to-the-point, this post by Milosz Galazka wins my "handy dandy article of the week" award. I'll work on the title.

Based off of his work, I've made this shell one-liner to reset it to "password". Your container must be running, named grafana, and your user part of the docker group for it to work:

ADMIN_PASSWORD="password";CONTAINER_ID=$(docker ps -qf "name=^grafana$");docker exec -it $CONTAINER_ID grafana-cli admin reset-admin-password $ADMIN_PASSWORD

And then Ctrl+P Ctrl+Q to detach from the container without stopping it.


[1]: How to reset admin password in Grafana container