Deploy with Docker Compose
Docker Compose is the recommended deployment method for Steam Headless. It allows you to specify device nodes, resource limits, capabilities, storage volumes, and network definitions in a single declarative docker-compose.yml file.
The examples include a working set of environment options. Use the container options reference to understand or customise them instead of copying settings between guides.
The timezone mount lets Steam Headless detect the host's timezone. To choose one explicitly, add an IANA value such as TZ: 'Europe/London' under environment; a valid TZ takes precedence over the host mount, with Etc/UTC as the final fallback. See Timezone for details.
Every example sets pids_limit: 8192. Linux counts processes and threads against this limit, and a gaming desktop needs substantially more capacity than a small service container. See container task and PID limits if an application does not start or SHUI reports PID limit reached.
Each service in the Compose examples defines hostname: steam-headless (or distinct hostnames for multi-container sessions). Steam Remote Play, Steam Link, Sunshine / Moonlight, and local network discovery use this hostname as the machine name advertised on your network. Customise hostname: to whatever name you want remote streaming clients to see.
Why Use Docker Compose?
Steam Headless requires specific device nodes (/dev/dri/renderD*, /dev/uinput, /dev/uhid, /dev/fuse), Linux capabilities, and private cgroup settings to support systemd and low-latency audio/video streaming. Writing these options into a docker-compose.yml file makes your configuration:
- Reproducible: Your exact hardware assignments and storage paths are recorded in plain text.
- Easy to Update: Pulling and restarting updated images takes two commands (
sudo docker compose pull && sudo docker compose up -d). - Multi-Container Ready: Defining multiple gaming sessions with independent storage and networks is simple using YAML service blocks.
1. Single-Container Deployment
Option A: Host Networking (Simplest Setup)
For a standalone gaming rig on a dedicated machine, host networking is the simplest deployment method. The container shares the host machine's IP address directly, requiring zero extra network configuration or host shims.
name: steam-headless
services:
desktop:
image: josh5/steam-headless:2
container_name: steam-headless
hostname: steam-headless
restart: unless-stopped
network_mode: host
# Required Linux capabilities for systemd, audio, and virtual input
cap_add:
- DAC_READ_SEARCH
- NET_ADMIN
- SYS_ADMIN
- SYS_NICE
- SYS_PTRACE
# Security options required for systemd cgroups and Flatpak sandboxes
security_opt:
- apparmor:unconfined
- seccomp=unconfined
- systempaths=unconfined
- writable-cgroups=true
cgroup: private
# Graceful systemd shutdown handling
stop_signal: SIGRTMIN+3
stop_grace_period: 30s
pids_limit: 8192
shm_size: 2gb
tty: true
environment:
PUID: '1000'
PGID: '1000'
# Hardware devices exposed to the container
devices:
- /dev/dri/renderD128:/dev/dri/renderD128
- /dev/fuse:/dev/fuse
- /dev/uinput:/dev/uinput
- /dev/uhid:/dev/uhid
# Allow dynamic input event minors allocated by sunshine and virtual controllers
device_cgroup_rules:
- 'c 13:* rwm'
# Isolated in-memory filesystems for the container, ensuring separation from the host and other Steam Headless containers
tmpfs:
- /run
- /run/lock
- /tmp
- /dev/input:rw,dev,mode=0755
volumes:
# Makes the host timezone available to Steam Headless
- /etc/localtime:/run/host-localtime:ro
# Read-only kernel input device discovery
- /sys/devices/virtual/input:/sys/devices/virtual/input:ro
# Persistent appliance state (credentials, TLS certificates)
- steam-headless-state:/var/lib/steam-headless
# Persistent system journal
- steam-headless-journal:/var/log/journal
# Persistent user home (configs, Proton prefixes, save data)
- ./data/home:/home/steamheadless:Z
# Dedicated game storage
- /mnt/storage/games:/mnt/games:z
volumes:
steam-headless-state:
steam-headless-journal:
Option B: Macvlan Networking (Dedicated LAN IP)
If you prefer your gaming container to have its own dedicated IP address on your local network (appearing like a separate physical PC to your router and Moonlight clients):
name: steam-headless
services:
desktop:
image: josh5/steam-headless:2
container_name: steam-headless
hostname: steam-headless
restart: unless-stopped
cap_add:
- DAC_READ_SEARCH
- NET_ADMIN
- SYS_ADMIN
- SYS_NICE
- SYS_PTRACE
security_opt:
- apparmor:unconfined
- seccomp=unconfined
- systempaths=unconfined
- writable-cgroups=true
cgroup: private
stop_signal: SIGRTMIN+3
stop_grace_period: 30s
pids_limit: 8192
shm_size: 2gb
tty: true
environment:
PUID: '1000'
PGID: '1000'
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'
# Isolated in-memory filesystems for the container, ensuring separation from the host and other Steam Headless containers
tmpfs:
- /run
- /run/lock
- /tmp
- /dev/input:rw,dev,mode=0755
volumes:
# Makes the host timezone available to Steam Headless
- /etc/localtime:/run/host-localtime:ro
- /sys/devices/virtual/input:/sys/devices/virtual/input:ro
- steam-headless-state:/var/lib/steam-headless
- steam-headless-journal:/var/log/journal
- ./data/home:/home/steamheadless:Z
- /mnt/storage/games:/mnt/games:z
networks:
session-lan:
ipv4_address: 192.168.1.50
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
volumes:
steam-headless-state:
steam-headless-journal:
2. Multi-Container Deployment
When hosting multiple gaming desktops on a single server, macvlan networking is required to prevent port collisions between Sunshine and SHUI services.
Option A: Shared Single GPU (Dual-Container)
Two independent gaming sessions sharing a single Intel or AMD graphics card. YAML anchors (&base-service and &base-env) are used to maintain clean configuration without duplication.
name: steam-headless
x-base-env: &base-env
PUID: '1000'
PGID: '1000'
x-base-service: &base-service
image: josh5/steam-headless:2
restart: unless-stopped
cap_add:
- DAC_READ_SEARCH
- NET_ADMIN
- SYS_ADMIN
- SYS_NICE
- SYS_PTRACE
security_opt:
- apparmor:unconfined
- seccomp=unconfined
- systempaths=unconfined
- writable-cgroups=true
cgroup: private
stop_signal: SIGRTMIN+3
stop_grace_period: 30s
pids_limit: 8192
shm_size: 2gb
tty: true
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
services:
desktop-a:
<<: *base-service
container_name: steam-headless-a
hostname: steam-headless-a
environment:
<<: *base-env
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/desktop-a:/home/steamheadless:Z
- /mnt/storage/games:/mnt/games:z
networks:
session-lan:
ipv4_address: 192.168.1.50
desktop-b:
<<: *base-service
container_name: steam-headless-b
hostname: steam-headless-b
environment:
<<: *base-env
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/desktop-b:/home/steamheadless:Z
- /mnt/storage/games:/mnt/games:z
networks:
session-lan:
ipv4_address: 192.168.1.51
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
volumes:
steam-headless-a-state:
steam-headless-a-journal:
steam-headless-b-state:
steam-headless-b-journal:
Option B: Multiple GPUs (3-Container Setup: Intel, AMD, NVIDIA)
On hosts equipped with multiple graphics cards (such as an Intel iGPU, an AMD Radeon card, and an NVIDIA GeForce card), each container can be pinned to its own dedicated GPU hardware:
name: steam-headless
x-base-service: &base-service
image: josh5/steam-headless:2
restart: unless-stopped
cap_add:
- DAC_READ_SEARCH
- NET_ADMIN
- SYS_ADMIN
- SYS_NICE
- SYS_PTRACE
security_opt:
- apparmor:unconfined
- seccomp=unconfined
- systempaths=unconfined
- writable-cgroups=true
cgroup: private
stop_signal: SIGRTMIN+3
stop_grace_period: 30s
pids_limit: 8192
shm_size: 2gb
tty: true
device_cgroup_rules:
- 'c 13:* rwm'
tmpfs:
- /run
- /run/lock
- /tmp
- /dev/input:rw,dev,mode=0755
services:
# Container 1: Pinned to Intel GPU
desktop-intel:
<<: *base-service
container_name: steam-headless-intel
hostname: steam-headless-intel
environment:
PUID: '1000'
PGID: '1000'
COMPOSITOR_RENDER_DEVICE: '/dev/dri/renderD128'
ENCODER_RENDER_DEVICE: '/dev/dri/renderD128'
devices:
- /dev/dri/renderD128:/dev/dri/renderD128
- /dev/fuse:/dev/fuse
- /dev/uinput:/dev/uinput
- /dev/uhid:/dev/uhid
volumes:
- /etc/localtime:/run/host-localtime:ro
- /sys/devices/virtual/input:/sys/devices/virtual/input:ro
- steam-headless-intel-state:/var/lib/steam-headless
- steam-headless-intel-journal:/var/log/journal
- ./data/homes/desktop-intel:/home/steamheadless:Z
- /mnt/storage/games:/mnt/games:z
networks:
session-lan:
ipv4_address: 192.168.1.50
# Container 2: Pinned to AMD GPU
desktop-amd:
<<: *base-service
container_name: steam-headless-amd
hostname: steam-headless-amd
environment:
PUID: '1000'
PGID: '1000'
COMPOSITOR_RENDER_DEVICE: '/dev/dri/renderD129'
ENCODER_RENDER_DEVICE: '/dev/dri/renderD129'
devices:
- /dev/dri/renderD129:/dev/dri/renderD129
- /dev/fuse:/dev/fuse
- /dev/uinput:/dev/uinput
- /dev/uhid:/dev/uhid
volumes:
- /etc/localtime:/run/host-localtime:ro
- /sys/devices/virtual/input:/sys/devices/virtual/input:ro
- steam-headless-amd-state:/var/lib/steam-headless
- steam-headless-amd-journal:/var/log/journal
- ./data/homes/desktop-amd:/home/steamheadless:Z
- /mnt/storage/games:/mnt/games:z
networks:
session-lan:
ipv4_address: 192.168.1.51
# Container 3: Pinned to NVIDIA GPU
desktop-nvidia:
<<: *base-service
container_name: steam-headless-nvidia
hostname: steam-headless-nvidia
runtime: nvidia
environment:
PUID: '1000'
PGID: '1000'
NVIDIA_VISIBLE_DEVICES: 'all'
NVIDIA_DRIVER_CAPABILITIES: 'all'
devices:
- /dev/dri/renderD130:/dev/dri/renderD130
- /dev/fuse:/dev/fuse
- /dev/uinput:/dev/uinput
- /dev/uhid:/dev/uhid
volumes:
- /etc/localtime:/run/host-localtime:ro
- /sys/devices/virtual/input:/sys/devices/virtual/input:ro
- steam-headless-nvidia-state:/var/lib/steam-headless
- steam-headless-nvidia-journal:/var/log/journal
- ./data/homes/desktop-nvidia:/home/steamheadless:Z
- /mnt/storage/games:/mnt/games:z
networks:
session-lan:
ipv4_address: 192.168.1.52
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
volumes:
steam-headless-intel-state:
steam-headless-intel-journal:
steam-headless-amd-state:
steam-headless-amd-journal:
steam-headless-nvidia-state:
steam-headless-nvidia-journal:
Optional operator settings
Normal first-run setup creates a temporary password and asks you to choose a permanent one in SHUI. Automated provisioning and Docker health monitoring are optional operator features; see the container options reference if you need them.
→ Next step: Configure a macvlan network or proceed directly to Configure Steam Headless.