-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subfolders of read-only volume are writeable #788
Comments
Looks similar to moby/moby#37838; basically, the moby/moby#38003 and the associated CLI changes in docker/cli#1430 added a I'm not sure though if that option works if there's an implicit volume defined in the image that you're running. @AkihiroSuda ptal |
Using apparmor seems the best approach here
Maybe we should consider automating these steps like |
Ok, understand ... |
It is mentioned in https://github.com/docker/cli/blob/master/man/docker-run.1.md , but I agree this should be also mentioned somewhere in https://docs.docker.com/ |
(The apparmor tips should be also documented, maybe after moby/moby#39923 gets merged) |
Ok, this should be documented more clearly, esp. here: https://docs.docker.com/storage/volumes/#use-a-read-only-volume |
It's tricky, because having writable mounts nested in a read-only mount is also an often-used use-case (e.g. mount |
The best way to go, if I get it right, is to simply just not bind mount top folders with nested mounts but to bind mount each mount on the host separately, if read-only is wanted. |
@AkihiroSuda do you think we could detect this situation, and return a warning if there's recursive mounts inside a read-only mount? |
Any update here? Would appreciate any advice for a workaround for this issue :) |
Just noticed this issue. This seems like a major security flaw. |
The workaround is to not bind mount nested mounts but bind mount the nested mounts separately |
You can specify a mount as non-recursive.. e.g. on the cli Recurssive bind mount works exactly the same way as it does with straight up Linux, no docker (because actually docker is just making a bind mound system call with |
Just wondering here... is it serious that this issue is a "feature" because in SOME RANDOM AND VERY SPECIFIC CASES one could want to write a nested dir in a read only volume/bind-mount ??????? Are you serious? For real??????? For an application as large as docker ????? It seems like a lack of competitors here. What about an optional scenario being just another option and the default being just the default? Am I mad? Am I dumb for saying that? |
This issue have been fixed in docker/for-linux#788
This issue have been fixed in docker/for-linux#788
I'm running a container and bind mount my /media directory read-only:
-v /media/:/media/:ro
within that /media folder I've mounted my drives containing media:
Expected behavior
The expected behavior would be that all subfolders within /media are read-only, but they aren't! The read-only tag isn't inherited to the subfolders.
Actual behavior
The subfolders, like drive, are able to be written to and got written by the process running within the container. No other containers or processes active writing those files.
Steps to reproduce the behavior
Run a container like alpine:
docker run -i -v /media/:/media/:ro -t alpine /bin/sh
where at least one drive is mounted into a subfolder (/media/drive/) and do
mkdir /media/drive/test
which works, despite:
A re-check with:
docker run -i -v /media/drive/:/media/:ro -t alpine /bin/sh
(note the direct bind mount of a subfolder) gives:
although "docker inspect" states:
Output of
docker version
:Output of
docker info
:I've googled around, read the docs and found no restrictions regarding the :ro tag not being inherited in special use cases!?
The text was updated successfully, but these errors were encountered: