Changing grafana password in docker environment

Hi, I’m trying to change the default password from a docker stack containing amongst others, grafana. I’m using Balena to deploy the image. My end goal would be to use a service variable in balena. tied to the password for Grafana, the first step would be to change it not using variables, instead feeding the user and password straight.

As a default, the login is admin/admin. I can create a new account, or update the password in the interface, but once the container restart the changes are reverted back to default.

The two options I’ve explored is;

  • Editing the config.ini that shares a folder with the Dockerfile.

admin_user = newuser
admin_password = newpassword

  • Editing the Docker Compose, adding;



However, both these approaches lead to admin/admin not working, and newuser/newpassword not working when rebuilding the container.

The only way I can get access is not setting any of these variables, instead using the default admin/admin login.