Changed variable in .env file is not picked up on container restart

I try to change the setting server / root_url to a different value.

I’m running Grafana v11.1.2 in a docker container (using docker compose) on a Raspberry Pi / debian. In a .env file in the directory where my docker-compose.yml file lives I have changed HOST=solarto HOST=solar.<mydomain>.

In my docker-compose.yml I have set:

    environment:
      - GF_SERVER_DOMAIN=${HOST:-localhost}
      - GF_SERVER_ROOT_URL=http://${HOST:-localhost}:3000

After issuing docker compose config I can see, that the change is picked up:

services:
  grafana:
    container_name: grafana
    [...]
    environment:
      [...]
      GF_SERVER_DOMAIN: solar.<mydomain>
      GF_SERVER_ROOT_URL: http://solar.<mydomain>:3000

After restarting the container however in Administration - General - Settings the config value of server / root_url is unchanged.

According to Configure Grafana | Grafana documentation the variable GF_SERVER_ROOT_URL should match the setting server / root_url. In the Grafana UI it says “These system settings are defined in grafana.ini or custom.ini (or overridden in ENV variables). To change these you currently need to restart Grafana.”

This does not happen.

On initial install my setting was actually interpreted, otherwise it would not be there in the first place.

Please advise on how this setting (and others) can actually be changed.

How did you restart container?

2 Likes
docker compose stop grafana
docker compose start grafana

(For the records: Did not work, see next reply for the solution.)

docker compose up -d grafana

This worked. Thank you for asking the right question! :grinning:

(Should have thought of this before. This may be worth a mention somewhere in the docs as well.)

That’s how docker-compose works, that is no related to grafana.
Otherwise Grafana doc should have cover all possible options how Grafana container can be orchestrated (k8s, Openshift, Nomad, swarm,…)