Shared Data Between Containers β
Sometimes you need several of your isolated environments to share the exact same files.
For example, you might want to:
- Share one API login file across multiple AI agents.
- Create a shared "memory" folder for different services to read from.
- Keep a central configuration directory that all your worker containers pull from.
The cleanest, most native way to do this in Terrarium is by creating a Shared LXD Custom Volume.
This creates an isolated chunk of storage that exists independently of any single container. You can attach it to as many containers as you want at the same time. If you delete a container, the shared volume (and its data) survives.
π οΈ The Easy Way: Using the LXD UI β
If you prefer a visual approach, you can do all of this right from your browser.
1. Create the Shared Volume β
- Open the LXD UI at
lxd.<your-domain>. - Go to Storage, select your
terrariumstorage pool, and click Volumes. - Click Create Volume and choose the
Customtype. - Name it something clear, like
agent-memory.
2. Attach It to Your Containers β
- Go to the Instances tab and select a container (e.g.,
openclaw). - Click Devices -> Add Device -> Disk.
- Choose the custom volume you just created (
agent-memory). - Set the Target Path where you want it to appear inside the container (e.g.,
/srv/shared-memory). - Repeat this process for any other containers that need access.
π» The Hacker Way: Using the CLI β
If you prefer the terminal, you can accomplish the exact same thing with a few quick commands.
1. Create the volume:
lxc storage volume create terrarium agent-memory2. Attach it to your containers:
lxc storage volume attach terrarium agent-memory openclaw agent-memory /srv/shared-memory
lxc storage volume attach terrarium agent-memory hermes agent-memory /srv/shared-memoryIf the path should be writable by the normal Terrarium container user, set ownership after attaching it:
lxc exec openclaw -- chown -R terrarium:terrarium /srv/shared-memory
lxc exec hermes -- chown -R terrarium:terrarium /srv/shared-memoryIn this example, both the openclaw and hermes containers can now read and write to the /srv/shared-memory folder, and they will instantly see each other's changes.
Example: Sharing a Single Login β
Let's say you have three separate AI containers (openclaw, hermes, and research), and you want all of them to use the same OpenAI Codex login.
Instead of authenticating three separate times, you can just share the folder where the tool expects its credentials to be stored.
# Create the volume
lxc storage volume create terrarium codex-auth
# Attach it exactly where the CLI expects the auth file to live
lxc storage volume attach terrarium codex-auth openclaw codex-auth /home/terrarium/.codex
lxc storage volume attach terrarium codex-auth hermes codex-auth /home/terrarium/.codex
lxc storage volume attach terrarium codex-auth research codex-auth /home/terrarium/.codex
# Make the mounted auth directory writable by the normal container user
lxc exec openclaw -- chown -R terrarium:terrarium /home/terrarium/.codex
lxc exec hermes -- chown -R terrarium:terrarium /home/terrarium/.codex
lxc exec research -- chown -R terrarium:terrarium /home/terrarium/.codexNow, just log into one of those containers, run the login command, and boomβall three containers are authenticated instantly.
When Not To Use This β
This feature is fantastic for small, internal state sharing. However, you should not use this if:
- You want to access the files directly from your personal laptop over the internet.
- You have massive amounts of data that shouldn't live on your VPS's main drive.
- The data needs to survive if you delete your entire VPS.
If you need any of those features, check out the External Shared Storage guide instead.