What changes in a container
A unit runs on the host or in a container, and which one is a property of its declaration. A container changes how a unit is started and isolated, and nothing about what the unit is.
What stays the same
A Plugin in a container has the same Manifest, registers the same way, holds the same Session, sends the same heartbeats and moves through the same lifecycle states as one on the host. Its author writes the same code against the same SDK. A unit never needs to know that it is in a container.
Declaring one
A unit runs in a container when it names an image in place of an exec.
units:
provision-store:
kind: oneshot
image: ghcr.io/example/provisioner@sha256:9f3c…
needs: [ "storage:datasets" ]
| Declared | Means |
|---|---|
image | the image, named by its digest. A reference by tag is refused. The digest is the reference, the integrity check and the identity at once |
needs | what the unit must reach, from the closed set of classes (identity and needs) |
Nothing else is declared. No engine option, no mount, no network setting and no user is written in a description: the Core derives each of them from the need, the engine and the host.
In the service form a container holds a unit of kind oneshot or interface. A Plugin unit in a
container arrives with the application form.
The channel across the boundary
A unit in a container reaches the Core through the same socket, at the same path it has on the host. The Core mounts the instance's socket directory into the container at its own path and hands the unit the same variables a unit on the host is handed.
| Mounted | Why |
|---|---|
| the instance's socket directory, at its own path | traffic crosses both ways: a Plugin binds its own socket inside, and the Core creates a stream's socket outside |
| what each declared need expands into | nothing else |
The default is no other mount. The host's filesystem, other instances and the rest of the host stay outside.
No network by default
A containerised unit gets no network interface unless it declares the need network. A unit
reaches the Core over the mounted socket and needs no interface for it.
- A unit with no
networkneed cannot reach the network, whatever runs inside it. - A channel is bound by the Core and never by the interface that consumes it, so a managed interface in a container publishes no port.
- An instance running unprivileged cannot bind a channel below the host's unprivileged port threshold, in a container or not.