opencontainers / opencontainers/runc

tmpfs permissions confusion

Open
#1,647 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
13.5k
Forks
2.3k
Avg merge
2d 8h
Merged PRs (30d)
30

Description

The thought below is spanning across both docker and runc. In case I should be addressing the issue somewhere else, please let me know.

I find a bit confusing how tmpfs mounts are implemented. Simply doing

docker run --mount type=tmpfs,destination=some-path-here,tmpfs-mode=1770 <...>

will produce variable outcome when the mount point already exists and when it doesn't. That is, the tmpfs-mode argument is effectively ignored when the mountpoint exists, since the mode is copied back from the destination directory (libcontainer/rootfs_linux.go:190).

Well, being familiar with this behaviour now, I think this might be useful (still I found nothing about this in docs: https://docs.docker.com/engine/admin/volumes/tmpfs/).

But why then uid/gid are not restored as well? Mounting a tmpfs over the existing directory will preserve mode bits, but replace uid and gid with root. So runc is stopping somewhere in between -- it does neither fully restore permissions from the existing mount point nor rely on tmpfs mount options (uid, gid, mode, etc). Can this be resolved into a fully consistent behaviour?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at libcontainer/rootfs_linux.go:190 and compare the tmpfs behavior when the destination directory exists versus when it does not. Read the linked Docker tmpfs documentation and trace how mode, uid, and gid are handled. Done requires an agreed, consistent behavior for these permissions, with the documentation updated if needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
devops, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.