Skip to content

Commit

Permalink
config: Require absolute mount destinations
Browse files Browse the repository at this point in the history
'destination' has been the path inside the container since c18c283
(Change layout of mountpoints and mounts, 2015-09-02, opencontainers#136).  My
personal preference is to have an explicit pivot root and allow paths
relative to the current working directory [1], but that would be a big
shift from the current OCI spec.  The only way the current spec lets
you turn off the root pivot is by not setting a mount namespace at all
(and even then, it's not clear if that turns off the pivot).  And the
config's root entry is required (despite my attempts to have it made
optional [2]), it's not really clear how containers that don't set a
mount namespace are supposed to work if they're supported at all.

You might be able to get away with something like:

  When a mount namespace is not set, destination paths are relative to
  the runtime's initial working directory (or relative to the
  config.json, or whatever).  When a mount namespace is set,
  destination paths are relative to the mount namespace's root.

but with mount-namespace-less containers already so unclear, it seems
better to just require absolute destinations.  If/when we get clearer
support for explicit pivot-root calls or containers that inherit the
host mount namespace (without re-joining it and losing their old
working directory), we can consider lifting the absolute-path
restriction.

[1]: https://github.com/wking/ccon/tree/v0.4.0#mount-namespace
[2]: https://groups.google.com/a/opencontainers.org/forum/#!topic/dev/6ZKMNWujDhU
     Date: Wed, 26 Aug 2015 12:54:47 -0700
     Subject: Dropping the rootfs requirement and restoring arbitrary bundle
       content
     Message-ID: <20150826195447.GX21585@odin.tremily.us>

Signed-off-by: W. Trevor King <wking@tremily.us>
  • Loading branch information
wking committed Nov 4, 2016
1 parent 41ef05e commit 1cf330b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions config.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ The runtime MUST mount entries in the listed order.
The parameters are similar to the ones in [the Linux mount system call](http://man7.org/linux/man-pages/man2/mount.2.html).

* **`destination`** (string, REQUIRED) Destination of mount point: path inside container.
This value MUST be an absolute path.
For the Windows operating system, one mount destination MUST NOT be nested within another mount (e.g., c:\\foo and c:\\foo\\bar).
* **`type`** (string, REQUIRED) The filesystem type of the filesystem to be mounted.
Linux: *filesystemtype* argument supported by the kernel are listed in */proc/filesystems* (e.g., "minix", "ext2", "ext3", "jfs", "xfs", "reiserfs", "msdos", "proc", "nfs", "iso9660").
Expand Down

0 comments on commit 1cf330b

Please sign in to comment.