boot2docker - Docker volumes doesn't exist for data container in 1.9.1 -
docker toolbox 1.9.1 on windows 7 platform
the data container created doesn't have volumes when use docker inspect
command.
$ sudo mkdir /abc $ docker run -d --name data -v /abc:/hostabc busybox true $ docker inspect --format "{{ .config.volumes }}" data map[]
i tried in 1.7.1, shows below
$ docker inspect --format "{{ .volumes }}" data # in 1.7.1 volumes directly map[/hostabc:/abc]
anything did wrong create data container ?
or there other place check volumes
in data container.
try instead
docker inspect -f '{{ (index .mounts 0).source }}' containerid
if have multiple sharing, simple use range
below
docker inspect -f '{{range $k := .mounts}}{{println $k.source }}{{end}}' containerid
as mentioned here, changed since docker 1.8
note: pr 45 raised op now merged directives like:
version=`$docker -v 2>&1 | awk -f'[ .]' '{printf "%2.f%02.f%02.f",$3,$4,$5}'` # echo $version if [ $version -gt 10800 ]; 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
Comments
Post a Comment