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

Change layout of mountpoints and mounts #136

Merged
merged 1 commit into from
Sep 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Spec struct {
// Hostname is the container's host name.
Hostname string `json:"hostname"`
// Mounts profile configuration for adding mounts to the container's filesystem.
MountPoints []MountPoint `json:"mounts"`
Mounts []MountPoint `json:"mounts"`
}

// Process contains information to start a specific application inside the container.
Expand Down
31 changes: 31 additions & 0 deletions config.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,37 @@ Each container has exactly one *root filesystem*, specified in the *root* object
}
```

## Mount Points

You can add array of mount points inside container as `mounts`.
Each record in this array must have configuration in [runtime config](runtime-config.md#mount-configuration).

* **name** (string, required) Name of mount point. Used for config lookup.
* **path** (string, required) Destination of mount point: path inside container.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<nit>Maybe “Mount destination in the container filesystem”? The colon-separated form works, but it took me a reread to understand what it meant.</nit>.


*Example*

```json
"mounts": [
{
"name": "proc",
"path": "/proc"
},
{
"name": "dev",
"path": "/dev"
},
{
"name": "devpts",
"path": "/dev/pts"
},
{
"name": "data",
"path": "/data"
}
]
```

## Process configuration

* **terminal** (bool, optional) specifies whether you want a terminal attached to that process. Defaults to false.
Expand Down
29 changes: 14 additions & 15 deletions runtime-config.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Mount Configuration

Additional filesystems can be declared as "mounts", specified in the *mounts* array. The parameters are similar to the ones in Linux mount system call. [http://linux.die.net/man/2/mount](http://linux.die.net/man/2/mount)
Additional filesystems can be declared as "mounts", specified in the *mounts* object.
Keys in this object are names of mount points from portable config.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link with “… of [mount points from the portable config](config.md#mount-points)”?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link is now on line 7 (“Only [mounts from …]”), so I'm fine leaving this line as it stands.

Values are objects with configuration of mount points.
The parameters are similar to the ones in [the Linux mount system call](http://man7.org/linux/man-pages/man2/mount.2.html).
Only [mounts from the portable config](config.md#mount-points) will be mounted.

* **type** (string, required) Linux, *filesystemtype* argument supported by the kernel are listed in */proc/filesystems* (e.g., "minix", "ext2", "ext3", "jfs", "xfs", "reiserfs", "msdos", "proc", "nfs", "iso9660"). Windows: ntfs
* **source** (string, required) a device name, but can also be a directory name or a dummy. Windows, the volume name that is the target of the mount point. \\?\Volume\{GUID}\ (on Windows source is called target)
Expand All @@ -10,45 +14,40 @@ Additional filesystems can be declared as "mounts", specified in the *mounts* ar
*Example (Linux)*

```json
"mounts": [
{
"mounts": {
"proc": {
"type": "proc",
"source": "proc",
"destination": "/proc",
"options": []
},
{
"dev": {
"type": "tmpfs",
"source": "tmpfs",
"destination": "/dev",
"options": ["nosuid","strictatime","mode=755","size=65536k"]
},
{
"devpts": {
"type": "devpts",
"source": "devpts",
"destination": "/dev/pts",
"options": ["nosuid","noexec","newinstance","ptmxmode=0666","mode=0620","gid=5"]
},
{
"data": {
"type": "bind",
"source": "/volumes/testing",
"destination": "/data",
"options": ["rbind","rw"]
}
]
}
```

*Example (Windows)*

```json
"mounts": [
{
"mounts": {
"myfancymountpoint": {
"type": "ntfs",
"source": "\\\\?\\Volume\\{2eca078d-5cbc-43d3-aff8-7e8511f60d0e}\\",
"destination": "C:\\Users\\crosbymichael\\My Fancy Mount Point\\",
"options": []
}
]
}
```

See links for details about [mountvol](http://ss64.com/nt/mountvol.html) and [SetVolumeMountPoint](https://msdn.microsoft.com/en-us/library/windows/desktop/aa365561(v=vs.85).aspx) in Windows.
8 changes: 4 additions & 4 deletions runtime_config.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package specs

type RuntimeSpec struct {
// Mounts profile configuration for adding mounts to the container's filesystem.
Mounts []Mount `json:"mounts"`
// Mounts is a mapping of names to mount configurations.
// Which mounts will be mounted and where should be chosen with MountPoints
// in Spec.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unfortunate that *Spec didn't change to *Config as part of 7232e4b (specs: introduce the concept of a runtime.json, 2015-07-30, #88), but that's probably orthogonal to this PR ;).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe “MountPoints in Spec” → “Spec.Mounts”?

Mounts map[string]Mount `json:"mounts"`
// Hooks are the commands run at various lifecycle events of the container.
Hooks Hooks `json:"hooks"`
}
Expand All @@ -29,8 +31,6 @@ type Mount struct {
// Source specifies the source path of the mount. In the case of bind mounts on
// linux based systems this would be the file on the host.
Source string `json:"source"`
// Destination is the path where the mount will be placed relative to the container's root.
Destination string `json:"destination"`
// Options are fstab style mount options.
Options []string `json:"options"`
}