Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additionally search for Volumes from within Config #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Additionally search for Volumes from within Config #32

wants to merge 1 commit into from

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