docs icon indicating copy to clipboard operation
docs copied to clipboard

tmpfs-mode does not default to 1777 as documented

Open jdmarshall opened this issue 3 years ago • 0 comments

File: storage/tmpfs.md reports that the default mode is 1777. I don't know when this was the case, but it's not true in 20.10.7

docker --version Docker version 20.10.7, build f0df350

docker run -it --mount type=tmpfs,destination=/var/lib/nginx/tmp my-image:latest /bin/bash

ls -la /var/lib/nginx

...
drwx------    2 root     root            40 Sep  7 18:56 tmp

In fact tmpfs-mode seems to be ignored if the file being mounted already exists:

docker run -it --mount type=tmpfs,destination=/var/lib/nginx/tmp,tmpfs-mode=1777 my-image:latest /bin/bash
bash-5.1# ls -la /var/lib/nginx
...
drwx------    2 root     root            40 Sep  7 19:02 tmp

Note that originally the tmp directory was nginx:nginx, so this breaks things quite badly.

Near as I can tell, this set of instructions only functions if the mount point doesn't exist at all on the image, which is not a manner of running or building Docker images that I've noticed anyone using before. It seems to me that clobbering a directory with a mount is the default, not a corner case.

jdmarshall avatar Sep 07 '22 19:09 jdmarshall