I want to use mount command inside docker (kubernetes).
It is not allowed to make mount option when building, start running docker container.
I didn't wanted to give privilege permission, so I added capabilites (SYS_ADMIN and MKNOD). but AppArmor seems to block mount, so I unconfined apparmor and seccomp (not sure seccomp does block mount)
I only should add SYS_ADMIN and MKNOD but I added all capabilites (in case of other issues)
docker run -it --cap-add=ALL --security-opt apparmor:unconfined --security-opt seccomp=unconfined ubuntu bash
after entering docker container, I tried those command but I still couldn't mount
mknod /dev/loop0 b 7 0
dd if=/dev/zero of=./test.img bs=1G count=1
mkfs.ext4 test.img
mkdir /home/worker/test
mount -o loop,ro test.img /home/worker/test
mount: /home/worker/test: mount failed: Operation not permitted.
I couldn't guess any more reasons, why mount
is blocked.
I searched and found some mount
examples, and I successed mount --bind
with those docker options, but bind mounting and mounting (with loop back option) are obviously different.
What should I see more?