Skip to content

Commit

Permalink
Merge pull request containers#19406 from rhatdan/volumes
Browse files Browse the repository at this point in the history
Fix up man page and add test on globs
  • Loading branch information
openshift-merge-robot authored Aug 2, 2023
2 parents e581360 + ee9fb36 commit cd5ce63
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 8 additions & 1 deletion docs/source/markdown/options/mount.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
8 changes: 8 additions & 0 deletions test/system/060-mount.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit cd5ce63

Please sign in to comment.