SMTP configuration for docker container

Hi,
i’m running grafana in a docker container on my raspberry pi 3+ with the grafana/grafana-arm32v7-linux image. So far, so good. Now I want to use the alert system for sending an e-mail when there’s something wrong. For this setup I know i need to configure the SMTP in grafana. How can I do it? I think I have to edit the .ini file but I’m not sure how does that work in a docker container.

If you’re working with containers you can set the .ini via docker volume mapping our you can set the environment variables that maps to .ini parameters.

If you can’t configure via volume, you can set the environment variables like this :

docker run \
  -d \
  -p 3000:3000 \
  --name grafana \
  -e "GF_SMTP_ENABLED=true" \
  -e "GF_SMTP_HOST=smtp.example.com" \
  -e "GF_SMTP_USER=myuser" \
  -e "GF_SMTP_PASSWORD=mysecret" \
  grafana/grafana:5.1.0

Take a look ate docker documentation about environment variables and volumes.

3 Likes