Volumes and storage
A container’s own filesystem is thrown away on every redeploy. Anything you want to keep goes in a named volume.
services: db: image: postgres:17 volumes: - pgdata:/var/lib/postgresql/data x-cargoforge: storage_limit_gb: 10
volumes: pgdata:The rules
Section titled “The rules”- Named volumes only:
name:/path(orname:/path:ro). Host paths such as./data:/dataor/srv:/srvare refused, and so is a bare/pathwith no name. - A named volume persists across redeploys, restarts, stops and rollbacks, and is included in backups.
- Each service’s volumes live on that service’s own disk, sized with
x-cargoforge.storage_limit_gb(default 2 GB, up to 25 GB). When it fills up, writes fail, so size it with room to grow, or grow it later from the dashboard. - A service with a volume is fragile by default: on a redeploy its old copy stops before the new one starts, so two copies never write the same data.
No volume, no backup
Section titled “No volume, no backup”A project whose services mount no volume has nothing to back up. The dashboard warns about it (once by email, and on the project’s Backups tab), and automatic backups skip it. That’s fine for a stateless app; for anything with a database, add a volume.
Common data paths
Section titled “Common data paths”| Image | Mount a volume at |
|---|---|
postgres |
/var/lib/postgresql/data |
mysql, mariadb |
/var/lib/mysql |
mongo |
/data/db |
redis (with persistence on) |
/data |
minio |
the path you pass to server, e.g. /data |