List of Docker container volumes
4 answers
docker inspect
provides all the information you need. Using grep to filter the output is not very good. This option is --format
docker inspect
better suited for filtering the output.
For docker 1.12 and possibly earlier, this lists all volumes :
docker inspect --format='{{range .Mounts}}{{.Destination}} {{end}}' <containerid>
You can add whatever information you like from the validation data in your release and use the go template language to validate the output as per your needs.
The following output will display all local volumes as in the first example, and if it is not a local volume it also prints the source with it.
docker inspect --format='{{range .Mounts}}{{if eq .Driver "local"}}{{.Destination}} {{else}} {{.Source}}:{{.Destination}} {{end}} {{end}}' <cid>
0
source to share