|
| 1 | +# `com.docker.sandbox/host-mount@1` |
| 2 | + |
| 3 | +One host directory shared with the host and across sandboxes composing |
| 4 | +the same Kit. The runtime chooses its location and mount mechanism; |
| 5 | +Linux bind mounts and VM filesystem sharing can satisfy the same grant. |
| 6 | +Use [volume@1](volume@1.md) for sandbox storage without this sharing |
| 7 | +contract. |
| 8 | + |
| 9 | +- **Shape**: instance — one entry per path; duplicates rejected. |
| 10 | +- **Permission surface**: yes — the path, separately marked host-shared. |
| 11 | + |
| 12 | +## Config |
| 13 | + |
| 14 | +```yaml |
| 15 | +- type: com.docker.sandbox/host-mount@1 |
| 16 | + config: |
| 17 | + path: /home/agent/.cache/pip # REQUIRED, absolute and canonical |
| 18 | + mode: "0755" # optional initial directory permissions |
| 19 | +``` |
| 20 | +
|
| 21 | +| Field | Type | Rules | |
| 22 | +|---|---|---| |
| 23 | +| `path` | string | REQUIRED. Absolute, canonical in-container path; no `.`, `..`, doubled separators, trailing slash, NUL, or root `/`. | |
| 24 | +| `mode` | string | optional. Octal (`755`, `0755`, `1777`), applied when the runtime creates the directory. | |
| 25 | + |
| 26 | +There is no host-path field. The Kit requests where storage appears |
| 27 | +inside the sandbox, not which host files it can access. |
| 28 | + |
| 29 | +## Runtime behavior |
| 30 | + |
| 31 | +A conforming runtime: |
| 32 | + |
| 33 | +- **MUST NOT** let the Kit choose the host directory's location. <!-- tck: host-mount@1/runtime-owned-location --> |
| 34 | + The runtime owns it; a user MAY explicitly choose a replacement. |
| 35 | +- **MUST** key the directory on the declaring Kit's identity and the <!-- tck: host-mount@1/isolated-by-kit --> |
| 36 | + cleaned `path`, so sandboxes composing the same Kit share storage, |
| 37 | + while another Kit declaring that path does not inherit it. |
| 38 | +- **MUST** keep distinct destinations of the same Kit in separate <!-- tck: host-mount@1/isolated-by-path --> |
| 39 | + directories. A Kit's identity alone is not the storage key. |
| 40 | +- **MUST** use a Kit identity another Kit cannot claim. A published <!-- tck: host-mount@1/identity-not-self-declared --> |
| 41 | + repository can supply that identity; descriptor display metadata and |
| 42 | + `source` attribution cannot. Identity for unpublished Kits is |
| 43 | + runtime-owned. |
| 44 | +- **MUST** reuse the directory across tag or digest updates within one <!-- tck: host-mount@1/survives-kit-update --> |
| 45 | + Kit identity. Updating a Kit does not allocate fresh storage. |
| 46 | +- **MUST** mount the directory at `path` before lifecycle hooks run. <!-- tck: host-mount@1/mounted-before-hooks --> |
| 47 | +- **MUST** allow concurrent sandboxes of the same Kit to read and write <!-- tck: host-mount@1/shared-concurrently --> |
| 48 | + the directory. Kits coordinate access; the grant promises no locking |
| 49 | + or transactional behavior. |
| 50 | +- **MUST** keep the directory's contents independently of any sandbox, <!-- tck: host-mount@1/survives-sandbox-removal --> |
| 51 | + including after its last sandbox is removed. |
| 52 | +- **MUST** let the user find and remove the directory and access its <!-- tck: host-mount@1/listed-and-removable --> |
| 53 | + contents from the host. Sandbox writes reach this directory. |
| 54 | +- **SHOULD** make the mount root writable by the agent user (uid 1000). <!-- tck: host-mount@1/agent-writable-root --> |
| 55 | +- **SHOULD** apply `mode` when creating the directory; reopening it <!-- tck: host-mount@1/initial-mode-applied --> |
| 56 | + preserves existing permissions and contents. |
| 57 | + |
| 58 | +Filesystem semantics MAY be weaker than those of `volume@1`: ownership |
| 59 | +may be mapped from the host and overlayfs upper layers or xattrs may be |
| 60 | +unavailable. Kits requiring those semantics use `volume@1`. |
| 61 | + |
| 62 | +A runtime without host-directory sharing does not advertise this type. |
| 63 | +An unclaimed required entry **MUST** fail closed; an optional one <!-- tck: host-mount@1/unadvertised-is-unmet --> |
| 64 | +**MUST** be skipped and recorded without a host-sharing grant. |
| 65 | + |
| 66 | +## Composition |
| 67 | + |
| 68 | +Paths union across the set. `host-mount@1` and `volume@1` share the |
| 69 | +cleaned in-container path as their storage identity key. |
| 70 | + |
| 71 | +Two Kits declaring the same path, whether both use `host-mount@1` or <!-- tck: host-mount@1/no-silent-merge --> |
| 72 | +one uses `volume@1`, conflict. A runtime **MUST NOT** silently merge |
| 73 | +them, even when their configs are identical: shared storage has one |
| 74 | +declaring Kit identity. |
| 75 | + |
| 76 | +## Gate |
| 77 | + |
| 78 | +The permission surface **MUST** list host-shared paths separately from <!-- tck: host-mount@1/separate-permission-surface --> |
| 79 | +`volume@1` storage paths. Data written here reaches the host and other |
| 80 | +sandboxes of the same Kit. A new path widens the grant; moving a path |
| 81 | +from `volume@1` to `host-mount@1` also widens it. `mode` changes do not. |
0 commit comments