Skip to content

rootless: bind mount: fix "operation not permitted"#42230

Merged
thaJeztah merged 1 commit into
moby:masterfrom
AkihiroSuda:fix-rootless-bind-EPERM
Apr 1, 2021
Merged

rootless: bind mount: fix "operation not permitted"#42230
thaJeztah merged 1 commit into
moby:masterfrom
AkihiroSuda:fix-rootless-bind-EPERM

Conversation

@AkihiroSuda

Copy link
Copy Markdown
Member

- What I did
Fix #42090

Fix #41876

Fix the following issue

$ sudo mount -t tmpfs -o noexec none /tmp/foo
$ docker --context=rootless run -it --rm -v /tmp/foo:/mnt:ro alpine
docker: Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:520: container init caused: rootfs_linux.go:60: mounting "/tmp/foo" to rootfs at "/home/suda/.local/share/docker/overlay2/b8e7ea02f6ef51247f7f10c7fb26edbfb308d2af8a2c77915260408ed3b0a8ec/merged/mnt" caused: operation not permitted: unknown.

- How I did it

Call getUnprivilegedMountFlags(m.Source)

- How to verify it

$ sudo mount -t tmpfs -o noexec none /tmp/foo
$ docker --context=rootless run -it --rm -v /tmp/foo:/mnt:ro alpine

- Description for the changelog

rootless: bind mount: fix "operation not permitted"

- A picture of a cute animal (not mandatory but encouraged)
🐧

The following was failing previously, because `getUnprivilegedMountFlags()` was not called:
```console
$ sudo mount -t tmpfs -o noexec none /tmp/foo
$ $ docker --context=rootless run -it --rm -v /tmp/foo:/mnt:ro alpine
docker: Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:520: container init caused: rootfs_linux.go:60: mounting "/tmp/foo" to rootfs at "/home/suda/.local/share/docker/overlay2/b8e7ea02f6ef51247f7f10c7fb26edbfb308d2af8a2c77915260408ed3b0a8ec/merged/mnt" caused: operation not permitted: unknown.
```

Signed-off-by: Akihiro Suda <[email protected]>
@AkihiroSuda

Copy link
Copy Markdown
Member Author

s390x failure is unrelated

@thaJeztah thaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

3 participants