Skip to main content
Version: 0.16.0

Identity and needs

A unit in a container runs as the account it would run as on the host, and is given what it declared it needs. The Core arranges both for the engine and the mode it finds: which user the container runs as, and how each need, whether a device, a directory, a display, audio or the network, is carried across the boundary. A description states neither. This page gives the identity per engine and mode, and what each need expands into on the host and in a container.

The identity across the boundary​

The process inside the container runs as the account that owns the instance's sockets. The Core translates that requirement per engine and per mode; a description never states it.

Engine and modeThe Core asks for
Podman, rootlessthe identity kept (keep-id), and no user
Docker, rootlessuser 0:0, which the engine maps to the launching account
either, running as rootthe launching account's user and group, by number
  • Supplementary groups are looked up by name on the host and carried as the numbers that lookup returned. A group carried across by number alone could land on a different group inside the image.
  • Anything mounted is created on the host first, with its ownership set. A path the engine had to create would belong to root.

What each need expands into​

A need is expanded at every launch, from the Core's environment and the host's filesystem as they are then. A need that cannot be expanded fails that launch, naming the need; the unit is Failed and the restart policy decides what follows.

NeedOn the hostIn a container, also
device:<name>the bound path must exist; the unit is handed it through ${bind.<name>}the device mapped at the same path; its owning group added where it is the account's way in — the account is in it, and the node does not let every account use it already — by number on an engine running as root, the account's own groups kept on rootless Podman, none on rootless Docker
storage:<name>the directory <state>/storage/<name>, created mode 0700 if absent; handed through ${bind.<name>}the directory mounted at the same path
displayWAYLAND_DISPLAY, as the socket's absolute path, and XDG_RUNTIME_DIR; DISPLAY and XAUTHORITY for X11each socket and the authority file mounted at the same path; no XDG_RUNTIME_DIR
audioPIPEWIRE_REMOTE and PULSE_SERVER=unix:<path>, for whichever socket existseach socket mounted at the same path
networknothingthe engine's default network, in place of none
  • A device is the only class a description binds. A directory and a secret are given by the runtime; a display, an audio path and a network are the host's own. A bind entry naming any of them is refused.
  • A display is found from WAYLAND_DISPLAY — a name under XDG_RUNTIME_DIR, or an absolute path — and from DISPLAY of the form :<n>, whose socket is /tmp/.X11-unix/X<n>. Where WAYLAND_DISPLAY is not set, the one socket named wayland-* under XDG_RUNTIME_DIR is the display, at every launch; more than one is a failed launch naming them, since which compositor to draw on is not the Core's to guess. No display found is a failed launch.
  • Audio is PipeWire's socket (PIPEWIRE_REMOTE, or pipewire-0 under XDG_RUNTIME_DIR) and PulseAudio's (PULSE_SERVER=unix:<path>, or pulse/native under XDG_RUNTIME_DIR). Neither present is a failed launch.
  • On rootless Podman the account's groups are kept through the runtime: crun honours it, runc does not, and under runc a device reachable only through a group is not reachable from the container.

The set of classes is closed. A need it cannot express is answered by running the unit on the host.