Ai-OPs
ai-ops.com
Docs
/
Installation
/

Backing Up Docker Volumes

Backing Up Docker Volumes

When You'd Use This

ScenarioWhy direct volume access
Koios won't start or is otherwise unreachableThe in-app UI is unavailable, so the only way to capture state is directly from the volumes
Migrating to a new hostLets you move the raw volumes between machines without going through the app
Host-level disaster-recovery scriptsVolumes can be snapshotted from the host on the same schedule as the rest of your infrastructure

If none of these apply, stop here and use the in-app backup instead.

Docker Volumes

All Koios data lives in seven Docker volumes:

VolumeContentsPriority
koios_data_postgresConfiguration database (devices, tags, users, models)Critical
koios_data_influxdbTime-series database (historical tag values)Critical
koios_secretsAuto-generated credentials (database passwords, the application secret key, time-series database token)Critical
koios_mediaUploaded files (ML models, component packages, stack wheels) and the built stacksCritical
koios_licenseLicense activation fileHigh
koios_certsCertificates, including any web-interface certificate you installed and its private keyMedium
koios_logsApplication log filesLow

The four Critical volumes are enough to rebuild a working install. The other three carry uploads and configuration that are convenient to keep but recoverable from elsewhere — though losing koios_certs drops the web interface back to its built-in self-signed certificate, so you would need to install your certificate again.

Backup

Back up a volume by running a temporary Alpine container that mounts the volume and creates a tar archive in the current directory:

docker run --rm \
  -v koios_data_postgres:/data \
  -v $(pwd):/backup \
  alpine tar czf /backup/koios_data_postgres.tar.gz -C /data .

Run the same command for each volume you want to back up, swapping the volume name and archive filename. At minimum, back up the four Critical volumes (koios_data_postgres, koios_data_influxdb, koios_secrets, koios_media). Add koios_license to keep an activated license, and koios_certs to keep an installed web-interface certificate.

To leave the built stacks out of the koios_media archive, exclude the stacks/ directory:

docker run --rm \
  -v koios_media:/data \
  -v $(pwd):/backup \
  alpine tar czf /backup/koios_media.tar.gz --exclude=./stacks -C /data .

The uploaded wheels are still archived, so you can rebuild each stack from Components > Stacks after restoring.

Restore

Stop Koios, then restore each archive back into its volume. This command deletes the volume's contents before extracting, so the restore is a clean replacement:

docker run --rm \
  -v koios_data_postgres:/data \
  -v $(pwd):/backup \
  alpine sh -c "rm -rf /data/* && tar xzf /backup/koios_data_postgres.tar.gz -C /data"

Repeat for every volume you need to restore, then start Koios again.

What's Next

  • Backup & Restore: the in-app backup that runs without stopping Koios and supports scheduled retention.