When running Omeka S in Docker for a research project, you may need to back it up before a server migration or contract expiration. This article summarizes the steps for extracting data, assuming SSH access and sudo privileges.
Docker Images vs. Data
A Docker image contains the application environment, while the data users have registered—images, metadata, and so on—is typically stored separately in a volume.
Check the volumes section in docker-compose.yml to see how each piece of data is mounted. A typical configuration looks like this:
volumes:
- omeka:/var/www/html/volume # named volume (file assets)
- ./modules:/var/www/html/modules # bind mount
- ./themes:/var/www/html/themes # bind mount
- ./config/local.config.php:/var/www/html/config/local.config.php:ro
Bind-mounted paths (./modules, etc.) have their data directly in the project directory on the host and can be copied as-is. Named volumes (omeka) are managed by Docker, so you need to find the physical path separately:
sudo docker volume inspect [project_name]_omeka
The "Mountpoint" field in the output (e.g., /var/lib/docker/volumes/.../_data) is the directory to back up.
Note that /var/lib/docker/ requires root, so sudo cd won’t work. Use sudo -s to open a root shell, or use sudo ls -la [path] to inspect the contents.
Three Things You Need to Back Up
A complete restore requires all three of the following.
File Assets (images, PDFs, etc.)
Archive the contents of the named volume:
sudo tar -cvzf ~/omeka_volume_backup.tar.gz \
-C /var/lib/docker/volumes/[project_name]_omeka/_data .
Database
Item metadata, page structure, and all other records live in the database (MariaDB/MySQL). With the DB container running, use mysqldump. Check database.ini or similar for connection details.
sudo docker compose exec [db_container_name] \
mysqldump -u [user] -p'[password]' [db_name] > ~/omeka_db_backup.sql
Themes, Modules, and Config Files
Since themes/, modules/, and config/ are bind-mounted from the project directory on the host, just archive them directly:
tar -cvzf ~/omeka_custom_assets.tar.gz themes/ modules/ config/
Restore Steps
Set up a fresh project directory and restore in the following order:
1. Extract themes/, modules/, config/ into the project directory
2. docker compose up to start the containers (creates the named volume)
3. Import the SQL file with the mysql command
4. Extract file assets into the named volume Mountpoint
5. Fix file permissions
Bind-mounted directories (themes/modules/config) are picked up automatically by docker compose up once they’re in place. To restore the named volume:
sudo tar -xvzf ~/omeka_volume_backup.tar.gz \
-C /var/lib/docker/volumes/[project_name]_omeka/_data
Omitting the permission step often causes images not to display:
sudo chown -R www-data:www-data /var/lib/docker/volumes/[project_name]_omeka/_data