diff --git a/docs/source/markdown/options/mount.md b/docs/source/markdown/options/mount.md index cc533315874f..3390e0651c85 100644 --- a/docs/source/markdown/options/mount.md +++ b/docs/source/markdown/options/mount.md @@ -32,7 +32,14 @@ Current supported mount TYPEs are **bind**, **devpts**, **glob**, **image**, **t ยท dst, destination, target: mount destination spec. - Paths matching globs, are mounted on the destination directory with the identical name inside the container. + When source globs are specified without the destination directory, + the files and directories are mounted with their complete path + within the container. When the destination is specified, the + files and directories matching the glob on the base file name + on the destination directory are mounted. The option + `type=glob,src=/foo*,destination=/tmp/bar` tells container engines + to mount host files matching /foo* to the /tmp/bar/ + directory in the container. Options specific to volume: diff --git a/test/system/060-mount.bats b/test/system/060-mount.bats index 918b5e11898e..3a12903349a5 100644 --- a/test/system/060-mount.bats +++ b/test/system/060-mount.bats @@ -284,6 +284,14 @@ EOF run_podman 125 run --rm --mount source=${PODMAN_TMPDIR}/v2\*,destination=/tmp/foobar, ro=false $IMAGE touch $vol2 is "$output" "Error: invalid reference format" "Default mounts don not support globs" + + mkdir $PODMAN_TMPDIR/foo1 $PODMAN_TMPDIR/foo2 $PODMAN_TMPDIR/foo3 + touch $PODMAN_TMPDIR/foo1/bar $PODMAN_TMPDIR/foo2/bar $PODMAN_TMPDIR/foo3/bar + touch $PODMAN_TMPDIR/foo1/bar1 $PODMAN_TMPDIR/foo2/bar2 $PODMAN_TMPDIR/foo3/bar3 + run_podman 125 run --rm --mount type=glob,source=${PODMAN_TMPDIR}/foo?/bar,destination=/tmp $IMAGE ls -l /tmp + is "$output" "Error: /tmp/bar: duplicate mount destination" "Should report conflict on destination directory" + run_podman run --rm --mount type=glob,source=${PODMAN_TMPDIR}/foo?/bar?,destination=/tmp,ro $IMAGE ls /tmp + is "$output" "bar1.*bar2.*bar3" "Should match multiple source files on single destination directory" } # vim: filetype=sh