Skip to content
v2.18.0GitHub

Data export and import

Learn how to export and import your Pocket ID data for backup or migration

The Pocket ID CLI lets you export and import your Pocket ID data. This is useful when creating backups, moving an installation to another instance, or switching database providers.

Use the export command to create a backup file:

Terminal window
pocket-id export --path ./path/to/export.zip

You can pass --path - to write the export to standard output. This is helpful when piping the archive or working with Docker:

Terminal window
pocket-id export --path - > ./path/to/export.zip

Exporting to standard output is often the simplest approach when running Pocket ID in Docker:

Terminal window
docker compose exec -T pocket-id ./pocket-id export --path - > ./path/to/export.zip
  1. Shut down your Pocket ID instance.
  2. Use the import command to restore a previously exported archive:
Terminal window
pocket-id import --path ./path/to/export.zip

Like export, you can use --path - to read from standard input:

Terminal window
pocket-id import --yes --path - < ./path/to/export.zip

When importing from standard input, you must include --yes to confirm the operation without a prompt. The following prompt cannot be shown when reading from standard input:

WARNING: This feature is experimental and may not work correctly. Please create a backup before proceeding and report any issues you encounter.
WARNING: Import will erase all existing data at the following locations:
Database: /app/data/pocket-id.db
Uploads Path: /app/data/uploads
Do you want to continue? [y/N]:

When using Docker, importing from standard input is often the easiest method:

Terminal window
cat ./export.zip | docker compose run -T pocket-id ./pocket-id import --yes --path -

The -T flag disables TTY allocation. Without it, Docker fails with the input device is not a TTY when piping data into the container, and binary output from the export may be corrupted.