skip to Main Content

Please how do I determine the container id or image name of an unknown docker volume?
For example I was able to find the list of docker volumes by running the command ‘docker volume ls’ but unfortunately when I was building some of the images I didn’t mount a specific volume so most of my containers were built without a volume name. some of the examples of volumes with unknown names are listed below

3199e3e4f3c2b79f04b84523959cb250223a229fca2ba16540cdbfd77762a552
c1cba1883daed381d83d9940d48e5f5aceed327614c58dc4bfa3cd7a6849274f
f2545f7cdef79e8c59dd8fc2a6d6de83876231554a738d25fe1f61f93c6b3eb9
f9cce0cfdd8ef8bae1e19aa41864e25f074929863a771b0ec729a119e2e880f7

Please how to determine the container id or image name of an unknown docker volumes

How can I determine which of the volumes is for MYSQL, JENKINS, PROMETHEUS for example??

REASON FOR MY QUESTION

I am trying to enable alerts on Grafana so I can get a notification via email but I got this error message

"For email alerts I get this message. SMTP not configured, check your grafana.ini config file’s [smtp] section"

This means that I have to edit the grafana.ini config file which is mounted in the docker grafana volume but I am not able to do this.

Please I will appreciate your help.

Thanks

3

Answers


  1. Please use:

    docker ps -a --filter volume={{reference}}
    

    Example:

    docker ps -a --filter volume=3199e3e4f3c2b79f04b84523959cb250223a229fca2ba16540cdbfd77762a552
    
    Login or Signup to reply.
  2. To see which volume is mapped into which container you can try:

    sudo docker ps -a --format '{{ .ID }}' | xargs -I {} docker inspect -f '{{ .Name }}{{ printf "n" }}{{ range .Mounts }}{{ printf "nt" }}{{ .Type }} {{ if eq .Type "bind" }}{{ .Source }}{{ end }}{{ .Name }} => {{ .Destination }}{{ end }}{{ printf "n" }}' {}
    

    This lists all containers and the volumes attached to it.

    I would recommend to host the grafana.ini file externally. Not necessarily via a volume but via file bind and tell grafana via environment variable where to find the grafana.ini. This gives you direct access to the file outside of the container. Here is the part of the docker command.

    -v /data/docker/volumes/grafana-config/grafana2.ini:/etc/grafana/grafana2.ini 
    -e "GF_PATHS_CONFIG=/etc/grafana/grafana2.ini" 
    

    The command above will show you something like this:

    /grafana
        bind /data/grafana/grafana-config/grafana2.ini => /etc/grafana/grafana2.ini
        volume grafana-storage => /var/lib/grafana
    
    Login or Signup to reply.
  3. You don’t need to work with Grafana volumes (actually, current official Grafana images don’t have any volume by default). You can configure Grafana with env variables. They have syntax GF_<grafana ini section>_<upper case properties>.

    grafama.ini config:

    #################################### SMTP / Emailing #####################
    [smtp]
    enabled = true
    

    can be achieved by Docker container env variable:

    GF_SMTP_ENABLED: true
    

    In theory you can also use volumes and ovewrite default container /etc/grafana/grafana.ini file with your own customized grafana.ini.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search