Portable Services Introduction

submited by
Style Pass
2024-12-12 08:30:04

systemd (since version 239) supports a concept of “Portable Services”. “Portable Services” are a delivery method for system services that uses two specific features of container management:

Applications are bundled. I.e. multiple services, their binaries and all their dependencies are packaged in an image, and are run directly from it.

The primary tool for interacting with Portable Services is portablectl, and they are managed by the systemd-portabled service.

Portable services don’t bring anything inherently new to the table. All they do is put together known concepts to cover a specific set of use-cases in a slightly nicer way.

A portable service is ultimately just an OS tree, either inside of a directory, or inside a raw disk image containing a Linux file system. This tree is called the “image”. It can be “attached” or “detached” from the system. When “attached”, specific systemd units from the image are made available on the host system, then behaving pretty much exactly like locally installed system services. When “detached”, these units are removed again from the host, leaving no artifacts around (except maybe messages they might have logged).

The OS tree/image can be created with any tool of your choice. For example, you can use dnf --installroot= if you like, or debootstrap, the image format is entirely generic, and doesn’t have to carry any specific metadata beyond what distribution images carry anyway. Or to say this differently: The image format doesn’t define any new metadata as unit files and OS tree directories or disk images are already sufficient, and pretty universally available these days. One particularly nice tool for creating suitable images is mkosi, but many other existing tools will do too.

Leave a Comment