How do I configure a custom host directory for Spacelift Launcher to avoid disk space issues?
Last updated: December 19, 2025
Context
When using Spacelift Launcher with container workers, you may encounter "no space left on device" errors during workspace archiving. This typically occurs when the default host directory (/opt/spacelift) is located on a volume with limited storage space. The workspace packaging process can use significant disk space (200MB+ per workspace), and you may need to redirect this to a larger storage mount on your host system.
Answer
To resolve this issue, configure Spacelift Launcher to use a custom host directory with more available storage space by setting the SPACELIFT_LAUNCHER_HOST_DIRECTORY environment variable.
Steps to configure a custom host directory:
Identify the host path with sufficient storage space (e.g.,
/mnt/spacelift)Add the following environment variable to your Spacelift Launcher configuration file (typically
/etc/spacelift-launcher.env):SPACELIFT_LAUNCHER_HOST_DIRECTORY=/mnt/spaceliftEnsure the specified directory exists and has appropriate permissions for the spacelift user
Restart the Spacelift Launcher service to apply the changes
Example configuration:
Your environment file should include the new variable alongside your existing configuration:
SPACELIFT_TOKEN=your_token
SPACELIFT_POOL_PRIVATE_KEY=your_key
SPACELIFT_LAUNCHER_HOST_DIRECTORY=/mnt/spacelift
Note: The launcher will automatically create subdirectories under the specified host directory and mount them into worker containers as needed. This approach is preferred over using SPACELIFT_WORKER_EXTRA_MOUNTS for this specific use case.
You can view all available launcher options by running the launcher with the --help flag.