Run multiple containers
Steam Headless is designed from the ground up for concurrent multi-seat operation. A single high-performance Linux host or homelab server can support three, four, or more simultaneous gaming sessions, allowing family members or LAN party guests to stream games simultaneously without dedicated physical consoles or virtualisation overhead.
Successfully scaling beyond two concurrent containers requires deliberate planning across four key host subsystems:
- CPU core pinning (
cpuset): Eliminating cache thrashing and scheduler latency jitter. - System memory & VRAM allocation: Preventing out-of-memory crashes and video memory saturation.
- Host inotify scaling: Setting a suitable file-notification capacity for the number of containers.
- Virtual seat separation: Keeping virtual gamepads and input devices inside the correct container.
CPU core pinning and affinity (cpuset)
By default, the Linux kernel scheduler distributes container threads dynamically across all available CPU cores. While efficient for web servers, dynamic thread migration between physical CPU cores, hyperthreaded sibling threads, or CCX dies on AMD Ryzen processors introduces:
- L1/L2/L3 cache misses: Game rendering threads stall while CPU caches are invalidated and reloaded.
- Scheduler latency jitter: Frame presentation times fluctuate, causing visible micro-stutter in the client video stream.
Pinning containers with Compose cpuset
Using Docker's cpuset directive binds each container to a dedicated set of CPU cores.
services:
desktop-a:
cpuset: '0-3' # Binds Container A to physical cores 0, 1, 2, and 3
# ... other configuration ...
desktop-b:
cpuset: '4-7' # Binds Container B to physical cores 4, 5, 6, and 7
# ... other configuration ...
desktop-c:
cpuset: '8-11' # Binds Container C to physical cores 8, 9, 10, and 11
# ... other configuration ...
desktop-d:
cpuset: '12-15' # Binds Container D to physical cores 12, 13, 14, and 15
# ... other configuration ...
Use lstopo or lscpu --extended to view your processor's topology. On multi-CCX processors (such as AMD Ryzen 9 5900X/7900X or 5950X/7950X), assign all cores for a given container within the same CCX (for example: cores 0-5 on CCX0 and cores 6-11 on CCX1). This eliminates inter-core latency across the AMD Infinity Fabric. For a deep dive into CPU pinning trade-offs and memory limits, see the Resource pinning and limits guide.
Host-wide inotify capacity scaling
One of the most critical host configuration requirements when running Steam Headless, especially with multiple containers, is tuning the Linux kernel's inotify instance limits.
Why inotify limits matter in multi-container deployments
The Linux kernel inotify subsystem allows applications to monitor filesystem events (file creation, modification, and deletion). Inotify groups are accounted per user namespace and numeric User ID (current_euid()).
Because all Steam Headless containers run their unprivileged desktop sessions, Steam clients, and background daemons under UID 1000 (steamheadless), every container on the host shares the host's UID 1000 inotify pool.
A complete Steam Headless desktop uses many inotify instances across Plasma, PipeWire, systemd, Flatpak, Steam, launchers, and games. The standard Linux distribution default ceiling of fs.inotify.max_user_instances = 128 leaves too little headroom for these applications and other host services.
When the shared pool is exhausted:
- New containers fail during startup with
EMFILEerrors (Too many open files). - KDE Plasma fails to load desktop widgets and taskbars.
- PipeWire sound servers cannot register audio endpoints.
- Steam crashes or fails to verify downloaded game files.
Docker rejects sysctl: fs.inotify.* in Compose or docker run because inotify parameters are not namespaced per container. This setting must be applied globally on the host operating system.
Step-by-step host inotify tuning
1. Inspect existing host limits
Run the following command on the host terminal:
sysctl fs.inotify.max_user_instances fs.inotify.max_user_watches fs.inotify.max_queued_events
Typical default output:
fs.inotify.max_user_instances = 128
fs.inotify.max_user_watches = 65536
fs.inotify.max_queued_events = 16384
2. Persist the tuned multi-container limit
Create a dedicated sysctl configuration file on the host:
printf '%s\n' 'fs.inotify.max_user_instances = 1024' | \
sudo tee /etc/sysctl.d/90-steam-headless-inotify.conf >/dev/null
The 1024 example is the standard recommendation for two or three concurrent containers. Use 3072 for four to eight containers and at least 8192 for nine or more. The complete inotify sizing table also covers a single-container host.
3. Apply the changes immediately
Reload the sysctl configuration:
sudo sysctl --load=/etc/sysctl.d/90-steam-headless-inotify.conf
Verify that the active value is now active:
sysctl fs.inotify.max_user_instances
# Output: fs.inotify.max_user_instances = 1024
4. Rollback procedure
To revert the host to its original state:
sudo rm -f /etc/sysctl.d/90-steam-headless-inotify.conf
sudo sysctl -w fs.inotify.max_user_instances=128
Input isolation
When multiple users play games simultaneously on the same host, gamepads, mice, and keyboards must never leak across sessions. Steam Headless handles this automatically, so you do not need to assign different XDG_SEAT values.
How Steam Headless enforces input segregation
Steam Headless solves input isolation via a multi-tiered architecture:
- Private
/dev/inputstorage: The host's physical/dev/inputis never mounted into the container. Each container starts with its own empty input directory. - Container-local input discovery: Steam Headless finds only virtual input devices created by processes inside that container and exposes them in its private input directory.
- Automatic seat name: Steam Headless generates an internal seat name and uses it consistently for the desktop and its devices. The name does not decide which container owns a device.
- Result: KWin, libinput, and games running inside Container A see only their own virtual controllers and input devices.
Memory and VRAM capacity planning
Plan your host hardware capacity using the following real-world memory profiles:
| Resource | Per-Container Budget | 4 Concurrent Containers | Notes |
|---|---|---|---|
| System RAM (Idle) | 1.3 GiB – 1.6 GiB | ~6 GiB | Base KDE Plasma, PipeWire, systemd, SHUI, Sunshine. |
Container /dev/shm | 2.0 GiB | 8.0 GiB | Required for Wayland DMA-BUF framebuffers and PipeWire audio. |
| Game Working Set | 4.0 GiB – 12.0 GiB | 16 GiB – 48 GiB | Depends on game title (e.g. 4 GB for indie/2D; 8–12 GB for AAA 3D). |
| Total Host RAM Target | 8 GiB – 16 GiB | 32 GiB – 64 GiB | Ensure at least 8–16 GiB of host swap is configured. |
| GPU VRAM | 2.0 GiB – 4.0 GiB | 8.0 GiB – 16.0 GiB | Dedicated GPU or partitioned across multiple physical cards. |
Complete 4-container production Compose template
The following docker-compose.yml provides a production-tested configuration for running four concurrent gaming sessions. Its environment settings are listed in the container options reference.
name: steam-headless-multicontainer
x-container-base: &container-base
image: josh5/steam-headless:2
privileged: false
cap_add:
- DAC_READ_SEARCH
- NET_ADMIN
- SYS_ADMIN
- SYS_NICE
- SYS_PTRACE
security_opt:
- seccomp=unconfined
- systempaths=unconfined
- writable-cgroups=true
cgroup: private
stop_signal: SIGRTMIN+3
stop_grace_period: 30s
pids_limit: 8192
shm_size: 2gb
devices:
- /dev/dri/renderD128:/dev/dri/renderD128
- /dev/fuse:/dev/fuse
- /dev/uinput:/dev/uinput
- /dev/uhid:/dev/uhid
device_cgroup_rules:
- 'c 13:* rwm'
tmpfs:
- /run
- /run/lock
- /tmp
- /dev/input:rw,dev,mode=0755
restart: unless-stopped
services:
# =========================================================================
# Container A (Seat A, Cores 0-3, IP .50)
# =========================================================================
desktop-a:
<<: *container-base
container_name: steam-headless-a
hostname: steam-headless-a
cpuset: '0-3'
environment:
PUID: '1000'
PGID: '1000'
volumes:
- /etc/localtime:/run/host-localtime:ro
- /sys/devices/virtual/input:/sys/devices/virtual/input:ro
- steam-headless-a-state:/var/lib/steam-headless
- steam-headless-a-journal:/var/log/journal
- ./data/homes/container-a:/home/steamheadless:Z
- ./data/games:/mnt/games:z
networks:
session-lan:
ipv4_address: 192.168.1.50
# =========================================================================
# Container B (Seat B, Cores 4-7, IP .51)
# =========================================================================
desktop-b:
<<: *container-base
container_name: steam-headless-b
hostname: steam-headless-b
cpuset: '4-7'
environment:
PUID: '1000'
PGID: '1000'
volumes:
- /etc/localtime:/run/host-localtime:ro
- /sys/devices/virtual/input:/sys/devices/virtual/input:ro
- steam-headless-b-state:/var/lib/steam-headless
- steam-headless-b-journal:/var/log/journal
- ./data/homes/container-b:/home/steamheadless:Z
- ./data/games:/mnt/games:z
networks:
session-lan:
ipv4_address: 192.168.1.51
# =========================================================================
# Container C (Seat C, Cores 8-11, IP .52)
# =========================================================================
desktop-c:
<<: *container-base
container_name: steam-headless-c
hostname: steam-headless-c
cpuset: '8-11'
environment:
PUID: '1000'
PGID: '1000'
volumes:
- /etc/localtime:/run/host-localtime:ro
- /sys/devices/virtual/input:/sys/devices/virtual/input:ro
- steam-headless-c-state:/var/lib/steam-headless
- steam-headless-c-journal:/var/log/journal
- ./data/homes/container-c:/home/steamheadless:Z
- ./data/games:/mnt/games:z
networks:
session-lan:
ipv4_address: 192.168.1.52
# =========================================================================
# Container D (Seat D, Cores 12-15, IP .53)
# =========================================================================
desktop-d:
<<: *container-base
container_name: steam-headless-d
hostname: steam-headless-d
cpuset: '12-15'
environment:
PUID: '1000'
PGID: '1000'
volumes:
- /etc/localtime:/run/host-localtime:ro
- /sys/devices/virtual/input:/sys/devices/virtual/input:ro
- steam-headless-d-state:/var/lib/steam-headless
- steam-headless-d-journal:/var/log/journal
- ./data/homes/container-d:/home/steamheadless:Z
- ./data/games:/mnt/games:z
networks:
session-lan:
ipv4_address: 192.168.1.53
networks:
session-lan:
driver: macvlan
driver_opts:
parent: eth0
macvlan_mode: bridge
ipam:
config:
- subnet: 192.168.1.0/24
gateway: 192.168.1.1
aux_addresses:
host-shim: 192.168.1.99
volumes:
steam-headless-a-state:
steam-headless-a-journal:
steam-headless-b-state:
steam-headless-b-journal:
steam-headless-c-state:
steam-headless-c-journal:
steam-headless-d-state:
steam-headless-d-journal: