Skip to content

Commit c18c283

Browse files
committed
Change layout of mountpoints and mounts
Added info about MountPoints to config.md. Signed-off-by: Alexander Morozov <[email protected]> Signed-off-by: W. Trevor King <[email protected]>
1 parent 138deee commit c18c283

File tree

4 files changed

+50
-20
lines changed

4 files changed

+50
-20
lines changed

config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type Spec struct {
1414
// Hostname is the container's host name.
1515
Hostname string `json:"hostname"`
1616
// Mounts profile configuration for adding mounts to the container's filesystem.
17-
MountPoints []MountPoint `json:"mounts"`
17+
Mounts []MountPoint `json:"mounts"`
1818
}
1919

2020
// Process contains information to start a specific application inside the container.

config.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,37 @@ Each container has exactly one *root filesystem*, specified in the *root* object
3434
}
3535
```
3636

37+
## Mount Points
38+
39+
You can add array of mount points inside container as `mounts`.
40+
Each record in this array must have configuration in [runtime config](runtime-config.md#mount-configuration).
41+
42+
* **name** (string, required) Name of mount point. Used for config lookup.
43+
* **path** (string, required) Destination of mount point: path inside container.
44+
45+
*Example*
46+
47+
```json
48+
"mounts": [
49+
{
50+
"name": "proc",
51+
"path": "/proc"
52+
},
53+
{
54+
"name": "dev",
55+
"path": "/dev"
56+
},
57+
{
58+
"name": "devpts",
59+
"path": "/dev/pts"
60+
},
61+
{
62+
"name": "data",
63+
"path": "/data"
64+
}
65+
]
66+
```
67+
3768
## Process configuration
3869

3970
* **terminal** (bool, optional) specifies whether you want a terminal attached to that process. Defaults to false.

runtime-config.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
## Mount Configuration
22

3-
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)
3+
Additional filesystems can be declared as "mounts", specified in the *mounts* object.
4+
Keys in this object are names of mount points from portable config.
5+
Values are objects with configuration of mount points.
6+
The parameters are similar to the ones in [the Linux mount system call](http://man7.org/linux/man-pages/man2/mount.2.html).
7+
Only [mounts from the portable config](config.md#mount-points) will be mounted.
48

59
* **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
610
* **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)
@@ -10,45 +14,40 @@ Additional filesystems can be declared as "mounts", specified in the *mounts* ar
1014
*Example (Linux)*
1115

1216
```json
13-
"mounts": [
14-
{
17+
"mounts": {
18+
"proc": {
1519
"type": "proc",
1620
"source": "proc",
17-
"destination": "/proc",
1821
"options": []
1922
},
20-
{
23+
"dev": {
2124
"type": "tmpfs",
2225
"source": "tmpfs",
23-
"destination": "/dev",
2426
"options": ["nosuid","strictatime","mode=755","size=65536k"]
2527
},
26-
{
28+
"devpts": {
2729
"type": "devpts",
2830
"source": "devpts",
29-
"destination": "/dev/pts",
3031
"options": ["nosuid","noexec","newinstance","ptmxmode=0666","mode=0620","gid=5"]
3132
},
32-
{
33+
"data": {
3334
"type": "bind",
3435
"source": "/volumes/testing",
35-
"destination": "/data",
3636
"options": ["rbind","rw"]
3737
}
38-
]
38+
}
3939
```
4040

4141
*Example (Windows)*
4242

4343
```json
44-
"mounts": [
45-
{
44+
"mounts": {
45+
"myfancymountpoint": {
4646
"type": "ntfs",
4747
"source": "\\\\?\\Volume\\{2eca078d-5cbc-43d3-aff8-7e8511f60d0e}\\",
48-
"destination": "C:\\Users\\crosbymichael\\My Fancy Mount Point\\",
4948
"options": []
5049
}
51-
]
50+
}
5251
```
5352

5453
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.

runtime_config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package specs
22

33
type RuntimeSpec struct {
4-
// Mounts profile configuration for adding mounts to the container's filesystem.
5-
Mounts []Mount `json:"mounts"`
4+
// Mounts is a mapping of names to mount configurations.
5+
// Which mounts will be mounted and where should be chosen with MountPoints
6+
// in Spec.
7+
Mounts map[string]Mount `json:"mounts"`
68
// Hooks are the commands run at various lifecycle events of the container.
79
Hooks Hooks `json:"hooks"`
810
}
@@ -29,8 +31,6 @@ type Mount struct {
2931
// Source specifies the source path of the mount. In the case of bind mounts on
3032
// linux based systems this would be the file on the host.
3133
Source string `json:"source"`
32-
// Destination is the path where the mount will be placed relative to the container's root.
33-
Destination string `json:"destination"`
3434
// Options are fstab style mount options.
3535
Options []string `json:"options"`
3636
}

0 commit comments

Comments
 (0)