Getting a list of volume paths

To list all volumes and associated paths for a docker (1.5.0) container, using go templating:

docker inspect --format='{{range $vol, $path := .Volumes}}{{$vol}} - {{$path}}{{"\n"}}{{end}}' <container name or id>

Using it in a bash script

Reading volumes and paths into an associative array in a bash script:

#! /bin/bash    
# read into associative array and print list
# provide docker container ID or name as parameter
a=`docker inspect --format='{{range $vol, $path := .Volumes}}["{{$vol}}"]="{{$path}}" {{end}}' $1`
eval "declare -A volumes=($a)"
for vol in "${!volumes[@]}"; do echo "$vol - ${volumes["$vol"]}"; done

Listing only volume ID's in a bash script

#! /bin/bash
# list volume ID's for container
# provide docker container ID or name as parameter
for vid in `docker inspect --format='{{range $vol, $path := .Volumes}}{{$path}}{{"\n"}}{{end}}' $1`; do
    echo ${vid##*/}
done