1

I have a simple setup, where I bind-mount a host's folder in a container.

docker run --rm -it -v /mnt:/mnt ubuntu:16.04 bash

Then I mount some other file systems to the host's folder. Mount points appear on the container side, but corresponding mounted file systems do not.

sudo mkdir /mnt/a
sudo mount /dev/sda /mnt/a

If I start a container with something pre-mounted under host's folder, they will be visible.

I believe I am missing something about how Linux cgroups work. Can anybody shed some light on what is going on?

I am running docker 17.03.0-ce

1 Answers1

1

Newer docker versions introduce more CLI options for volume control. Now one can specify options for mounting. Using option shared on a host-bound volume allows for mount propagations from host's mount namespace into container:

docker run --rm -it -v /mnt:/mnt:shared ubuntu:16.04 bash

Unmounts done inside the container will propagate back to the host