Skip to content
In correlation with the end of life (EOL) date for MSR 4.0.x, Mirantis stopped maintaining this documentation version as of July 17, 2026. The latest MSR product documentation is available here.

Single Instance Backup#

This section provides a comprehensive guide for single instance backup for Docker Compose MSR installation.

Prerequisites#

Stop Write Operations (Optional but Recommended)

Before backing up, set Harbor/MSR 4 to read-only mode to prevent data inconsistencies.

Enable Read-Only Mode in Harbor:

  1. Log in as an administrator.
  2. Go to AdministrationConfiguration.
  3. Under System Settings, enable Repository Read-Only mode.
  4. Click Save.

Backup Components#

A complete backup includes:

  • Registry Storage (Images and Artifacts)
  • Harbor Databases (PostgreSQL and Redis)
  • Configuration Files

Backup Registry Storage (Default: /data)#

If using filesystem storage, copy the image storage directory:

tar -czvf harbor-registry-backup.tar.gz /data

If using an S3-compatible backend, ensure retention policies exist on the object storage.

Backup Databases (PostgreSQL and Redis)#

MSR 4 uses PostgreSQL and Redis. Backup them separately.

Backup PostgreSQL:

docker exec -t harbor-db pg_dumpall -U harbor > harbor-db-backup.sql

Backup Redis (if needed - used for caching/session storage):

docker exec -t harbor-redis redis-cli save
cp /var/lib/redis/dump.rdb harbor-redis-backup.rdb

Backup Configuration Files

Back up the configuration and TLS certs from the install directory (typically /etc/harbor/):

tar -czvf harbor-config-backup.tar.gz /etc/harbor/

Restore Process#

If disaster recovery is needed, follow these steps:

  1. Stop Running Containers:

    docker compose down
    
  2. Restore Registry Storage:

    tar -xzvf harbor-registry-backup.tar.gz -C /
    
  3. Restore PostgreSQL Database:

    cat harbor-db-backup.sql | docker exec -i harbor-db psql -U postgres -d registry
    

    Use -d registry to restore into the correct database.

  4. Restore Redis (if needed):

    cp harbor-redis-backup.rdb /var/lib/redis/dump.rdb
    
  5. Restore Configuration Files:

    tar -xzvf harbor-config-backup.tar.gz -C /
    
  6. Restart Harbor:

    docker compose up -d
    
  7. Automate and Schedule Backups

    For regular automated backups, use cron jobs.

  8. Edit the crontab

    crontab -e
    
  9. Add a scheduled task to run nightly at 2 AM:

    0 2 * * * /bin/bash -c "tar -czvf /backup/harbor-registry-$(date +\%F).tar.gz /data && docker exec -t harbor-db pg_dumpall -U harbor > /backup/harbor-db-$(date +\%F).sql"
    

How Long Will This Take?#

Component Estimated Time
Configuration Files (/etc/harbor/) <1 minute
PostgreSQL DB Backup 1-5 minutes (depends on size)
Redis Backup <1 minute
Registry Storage (/data/) Varies (Minutes to Hours for TBs)