Skip to content

Commit

Permalink
Merge pull request #21 from jpbochi/inception
Browse files Browse the repository at this point in the history
better test to verify if any mount includes the current directory
  • Loading branch information
jpbochi authored Jun 28, 2017
2 parents 0625d0e + 728f641 commit 892d435
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drun
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,13 @@ if [ -f '/proc/1/cgroup' ]; then
EXTRA_OPTS="${EXTRA_OPTS:-} --volumes-from $CURRENT_CONTAINER"

# If current directory is inside any of the mounts of the current container
MOUNTS=$(docker inspect --format="{{range .Mounts}} -e '{{.Destination}}'{{end}}" ${CURRENT_CONTAINER})
if [ "0" != "$(echo "${CURRENT_DIR}" | grep -c ${MOUNTS})" ]; then
MAP_CURRENT_DIR_OPT=''
fi
MOUNTS=$(docker inspect --format="{{range .Mounts}}{{.Destination}} {{end}}" ${CURRENT_CONTAINER})
for MOUNT in $MOUNTS; do
if [ -z "${CURRENT_DIR##$MOUNT*}" ]; then # check if $CURRENT_DIR starts with $MOUNT
MAP_CURRENT_DIR_OPT=''
break
fi
done
fi
fi

Expand Down

0 comments on commit 892d435

Please sign in to comment.