Skip to content

Pre-existing host mounts are not restored despite mount propagation is active #2840

@specht478

Description

@specht478

Hi guys,

if I start a Podman container with a bind-mount of the type:

mount=type=bind,src=/tmp/origin,destination=/MNT,bind-propagation=rslave

and inside /tmp/origin/ there is something mounted: /tmp/origin/test_mountpoint

I can see all mounted files inside the container under /MNT/test_mountpoint/...

But if I checkpoint and restore that same container, /MNT/test_mountpoint/... will be empty if the mount /tmp/origin/test_mountpoint is present before restore.

Here are the commands to test this:

#Preparation:
dd if=/dev/zero of=/tmp/testfs.img bs=1M count=10 
sudo mkfs.ext4 /tmp/testfs.img


# Mount testfs before container creation
mkdir -p /tmp/origin/testfs
sudo mount -o loop /tmp/testfs.img /tmp/origin/testfs

sudo podman run \
    --name testc \
    --detach \
    --replace \
    --mount=type=bind,src=/tmp/origin,destination=/MNT,bind-propagation=rslave \
    --network=host \
    alpine \
    sleep infinity

# Mount in mount is visible from inside the container
sudo podman exec testc tree /MNT
#/MNT
#└── testfs
#    └── lost+found
#
# 2 directories, 0 files

# Unmount to allow checkpoint. If not: mnt: Mount 359 ./MNT/testfs (master_id: 232 shared_id: 0) has unreachable sharing
sudo umount /tmp/origin/testfs

# Checkpoint container
sudo podman container checkpoint testc

# Mount testfs again before restoring the container
sudo mount -o loop /tmp/testfs.img /tmp/origin/testfs

# Restore
sudo podman container restore testc

### Submount is not visible anymore
sudo podman exec testc tree /MNT
#/MNT
#└── testfs
#
#1 directories, 0 files

Is this expected behavior? Is there any way so that the mounted files are accessible from inside the container after restore?

Thanks in advance!

Regards
specht478

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions