mirror of
https://github.com/containers/podman.git
synced 2025-12-16 03:57:36 +08:00
Support all volume mounts for rootless containers
Fix handling of "bind" and "tmpfs" olumes to actually work. Allow bind, tmpfs local volumes to work in rootless mode. Also removed the string "error" from all error messages that begine with it. All Podman commands are printed with Error:, so this causes an ugly stutter. Fixes: https://github.com/containers/podman/issues/12013 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@@ -319,5 +319,30 @@ EOF
|
||||
is "$output" "" "no more volumes to prune"
|
||||
}
|
||||
|
||||
@test "podman volume type=bind" {
|
||||
myvoldir=${PODMAN_TMPDIR}/volume_$(random_string)
|
||||
mkdir $myvoldir
|
||||
touch $myvoldir/myfile
|
||||
|
||||
myvolume=myvol$(random_string)
|
||||
run_podman 125 volume create -o type=bind -o device=/bogus $myvolume
|
||||
is "$output" "Error: invalid volume option device for driver 'local': stat /bogus: no such file or directory" "should fail with bogus directory not existing"
|
||||
|
||||
run_podman volume create -o type=bind -o device=/$myvoldir $myvolume
|
||||
is "$output" "$myvolume" "should successfully create myvolume"
|
||||
|
||||
run_podman run --rm -v $myvolume:/vol:z $IMAGE \
|
||||
stat -c "%u:%s" /vol/myfile
|
||||
is "$output" "0:0" "w/o keep-id: stat(file in container) == root"
|
||||
}
|
||||
|
||||
@test "podman volume type=tmpfs" {
|
||||
myvolume=myvol$(random_string)
|
||||
run_podman volume create -o type=tmpfs -o device=tmpfs $myvolume
|
||||
is "$output" "$myvolume" "should successfully create myvolume"
|
||||
|
||||
run_podman run --rm -v $myvolume:/vol $IMAGE stat -f -c "%T" /vol
|
||||
is "$output" "tmpfs" "volume should be tmpfs"
|
||||
}
|
||||
|
||||
# vim: filetype=sh
|
||||
|
||||
@@ -63,7 +63,7 @@ function basic_setup() {
|
||||
for line in "${lines[@]}"; do
|
||||
set $line
|
||||
echo "# setup(): removing stray external container $1 ($2)" >&3
|
||||
run_podman rm $1
|
||||
run_podman rm -f $1
|
||||
done
|
||||
|
||||
# Clean up all images except those desired
|
||||
|
||||
Reference in New Issue
Block a user