Admin user/password is persisted and cannot be overwritten by env when run grafana docker

I am using docker image of grafana 4.6.3, when run a container, set the usr/pwd by inject env GF_SECURITY_ADMIN_USER and GF_SECURITY_ADMIN_PASSWORD, also mount /var/lib/grafana to a local volume.
Now I deleted the running container and start a new one, with different admin/password values passed to the container, and mount /var/lib/grafana to the same path. I found that the new value of admin/password cannot work, I still need the old user/password to login the grafana console. Seems the old user/password are stored somewhere in /var/lib/grafana and cannot be overwritten by new env.
Also, I tried to deleted the content in local volume and retried last step, the new user/password took effect.

 In my scenario, I really need to create new container with new user/password but still use old data stored in the persistent volume. I wonder whether this is the desired behavior, or a valid issue for grafana. Any workaround I can take to bypass this issue?

  Thanks in advance.


SInce you already have a database created your use case will not be supported by Grafana. I would recommend that you use the API in this scenario to change the admin password, for example after you’ve started your grafana instance.