Skip to content

Additionally search for Volumes from within Config#32

Open
leopoldodonnell wants to merge 1 commit intoSvenDowideit:masterfrom
leopoldodonnell:patch-1
Open

Additionally search for Volumes from within Config#32
leopoldodonnell wants to merge 1 commit intoSvenDowideit:masterfrom
leopoldodonnell:patch-1

Conversation

@leopoldodonnell
Copy link

docker inspect from Volume Containers using docker 1.8 are returning volumes in .Config.Volumes. Made a change to search both ways

docker inspect from Volume Containers using docker 1.8 are returning volumes in .Config.Volumes. Made a change to search both ways
@Oliboy50
Copy link
Contributor

+1

@niccokunzmann
Copy link

+1

@larrycai
Copy link
Contributor

Where does .Config.Volumes come from ? it states that it use .Mount instead in 1.8.x ?

And version < 1.8.x , it use .Volumes

@larrycai
Copy link
Contributor

I try to use patch like below, any comments ?

version=`docker -v 2>&1 | awk -F'[ .]' '{printf "%2.f%02.f%02.f",$3,$4,$5}'`
if [ $version -ge 10800 ]; then
    echo "docker version 1.8+"
    volumes=`$docker inspect --format='{{range $k := .Mounts}}{{println $k.Destination}}{{end}}' "$container" |  grep -v -E "^$"`
else
    echo "docker version <1.8"
    volumes=`$docker inspect --format='{{range $k,$v := .Volumes}}{{println $k}}{{end}}' "$container" |  grep -v -E "^$"`
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants