Skip to content
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

Significance of rbind when type:bind is removed #1744

Closed
Nabarun opened this issue Feb 27, 2018 · 2 comments
Closed

Significance of rbind when type:bind is removed #1744

Nabarun opened this issue Feb 27, 2018 · 2 comments

Comments

@Nabarun
Copy link

Nabarun commented Feb 27, 2018

Hi I don't want to bind my /tmp inside the container to my host system.
Currently my config.json was as follows
{
"destination": "/tmp",
"type": "bind",
"source": "/tmp",
"options": ["rbind","rw"]
}

I removed the "type" : "bind" from this node still I see the bindings in the host system. I thought that removal of type:bind will be preventing me to create the bind. Is that not the case here?
{
"destination": "/tmp",
"source": "/tmp",
"options": ["rbind","rw"]
}

@wking
Copy link
Contributor

wking commented Feb 27, 2018

If you don't want to bind /tmp into your container, just drop the whole entry. As long as it contains rbind in options, you'll get a bind mount.

@Nabarun
Copy link
Author

Nabarun commented Feb 27, 2018

Thanks for confirming that

@Nabarun Nabarun closed this as completed Feb 27, 2018
wking added a commit to wking/opencontainer-runtime-spec that referenced this issue Mar 6, 2018
This initially came in with b3918a2 (Add bind mount example,
2015-06-30), but the 'bind' value is not one of the types you can get
out of /proc/filesystems.  Instead, bind mounts should leave the type
unset and put either 'bind' or 'rbind' in options (although neither of
those are documented either [1]).  Since documenting (r)bind seems to
be too difficult, we should at least stop setting type in the example
to stop confusing users [2,3].

Runc still checks .Type instead of .Options for bind-ness in a few
places [4,5,6], but we can address all of those by setting .Device to
"bind" depending on .Options at [4].

[1]: opencontainers#771
[2]: opencontainers/runc#1744
[3]: https://groups.google.com/a/opencontainers.org/forum/#!topic/dev/2gia6t1Dnv0
     Subject: Runc default mount type
     Date: Tue, 6 Mar 2018 14:19:40 -0800 (PST)
     Message-Id: <57e18bd7-caad-4e21-bd7e-df016fda3efd@opencontainers.org>
[4]: https://github.com/opencontainers/runc/blob/v1.0.0-rc5/libcontainer/specconv/spec_linux.go#L272-L276
[5]: https://github.com/opencontainers/runc/blob/v1.0.0-rc5/libcontainer/rootfs_linux.go#L33
[6]: https://github.com/opencontainers/runc/blob/v1.0.0-rc5/libcontainer/rootfs_linux.go#L234

Signed-off-by: W. Trevor King <wking@tremily.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants