Dockerbak now includes comprehensive restore functionality, allowing you to restore backed-up containers to the same host or a completely different target host.
- Browse and select backup directories
- View all containers in a backup
- Select specific containers or restore all
- Choose target host (current or different)
- Restore to the same host where backup was created
- Restore to a completely different Docker host
- Automatic credential handling for target hosts
- Independent sudo configuration for target
- Docker images: Automatically pulls required images
- Networks: Recreates custom Docker networks
- Volumes: Restores all volume data with full contents
- Containers: Recreates containers with original configuration
All menu selections now explicitly require pressing Enter to confirm, preventing accidental selections.
Main Menu
? What would you like to do?
Backup individual container
Backup Docker Compose stack
❯ Restore from backup ← Select this
List all containers
List all stacks
Exit
Press ↓ arrow to navigate, Enter to select.
? Path to backup directory: /backups/nginx_20260101_143022
Browse to your backup folder and press Enter.
Found 1 container(s) in backup:
┏━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ # ┃ Container Name ┃ Image ┃
┡━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ 1 │ nginx │ nginx:latest │
└───┴─────────────────┴───────────────┘
For single container:
Automatically selected
For multiple containers:
? Restore all containers? (Y/n)
Or select specific ones:
? Select containers to restore:
◯ nginx (nginx:latest)
❯◉ postgres (postgres:15)
◯ redis (redis:alpine)
Use Space to select, Enter to confirm.
Option A: Restore to Current Host
? Restore to current host (192.168.1.35)? (Y/n) Y
Option B: Restore to Different Host
? Restore to current host (192.168.1.35)? (Y/n) n
Connect to Target Host
? Target hostname or IP: 192.168.1.50
? Username: root
? Password: ********
? Use sudo for Docker commands on target? (y/N)
✓ Connected to 192.168.1.50
Restoring 1 container(s)...
━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:45
✓ Restore completed!
Restored 1 container(s)
Target host: 192.168.1.50
For each container, Dockerbak automatically:
-
Pulls Docker Image
- Downloads the container image to target host
- Uses the same version as in backup
-
Restores Networks
- Creates custom Docker networks
- Skips default networks (bridge, host, none)
- Configures network settings
-
Restores Volumes
- Creates new Docker volumes on target
- Uploads volume archives via SFTP
- Extracts data into volumes
- Names volumes with
_restoredsuffix
-
Creates Container
- Recreates container with original:
- Environment variables
- Port mappings
- Labels
- Restart policies
- Network connections
- Volume mounts (using restored volumes)
- Working directory
- User configuration
- Recreates container with original:
Restored volumes are named: <original_path>_restored
Example:
- Original: Container mounted
/var/lib/mysql - Restored volume:
var_lib_mysql_restored
This prevents conflicts with existing volumes and clearly identifies restored data.
Backup from production server → Restore to staging server
Backup from failed server → Restore to replacement server
Backup from production → Restore to local development
Backup from server A → Restore to servers B, C, D
-
Check Target Docker Version
- Ensure Docker is installed on target
- Version compatibility with backup images
-
Verify Network Connectivity
- SSH access to target host
- Sufficient bandwidth for volume transfers
- Firewall rules allow Docker ports
-
Ensure Sufficient Space
- Disk space for Docker images
- Volume data storage
- Temporary space for extraction
- Container Names: If a container with the same name exists, restore will fail
- Port Conflicts: Ensure ports aren't already in use
- Image Availability: Images must be pullable from registries
- Large Volumes: May take time depending on size and network speed
-
Verify Containers
docker ps docker logs <container_name>
-
Check Volume Data
docker volume ls docker run --rm -v <volume_name>:/data alpine ls /data
-
Test Connectivity
- Verify port access
- Test application functionality
- Check inter-container communication
Error: Conflict. The container name "/nginx" is already in use
Solution:
- Stop/remove existing container, or
- Edit metadata.json to change container name
Error: bind: address already in use
Solution:
- Stop service using the port
- Modify port mappings in metadata.json
Error: image not found
Solution:
- Check internet connectivity
- Verify image exists in registry
- Pull image manually first
Error: permission denied while trying to connect to Docker daemon
Solution:
- Answer 'Y' to "Use sudo for Docker commands on target?"
- Or add user to docker group on target
Warning: network already exists
Solution:
- This is informational, restore will continue
- Network will be reused if compatible
You can restore only specific containers from a multi-container backup.
Restore supports moving containers between:
- Different Linux distributions
- x86 → x86 (same architecture required for volumes)
- Docker versions (with compatibility)
Edit the restore process to skip volume restoration if you only need the container configuration.
-
SSH Credentials
- Target host credentials can be saved or entered once
- Encrypted with master password
-
Volume Data
- Transferred via SFTP (encrypted)
- Temporary files cleaned up after extraction
-
Sudo Usage
- Only requested when needed
- Limited to Docker commands
- Image Size: Larger images take longer to pull
- Volume Data: More data = longer transfer time
- Network Speed: SSH/SFTP transfer rate
- Target Host: Disk I/O performance
| Component | Small | Medium | Large |
|---|---|---|---|
| Image Pull | 10s | 1m | 5m |
| Volume Transfer | 30s | 5m | 30m |
| Container Create | 5s | 10s | 20s |
1. Run: ./dockerbak.py
2. Select: Restore from backup
3. Path: ./backups/nginx_20260101_143022
4. Restore all: Yes
5. Current host: Yes
6. Done!
1. Run: ./dockerbak.py (connected to source host)
2. Select: Restore from backup
3. Path: ./backups/webapp_20260101_150000
4. Select containers: All 3 containers
5. Current host: No
6. Target: 192.168.1.60
7. Credentials: Enter or use saved
8. Sudo on target: Yes
9. Restore begins
10. Verify on target host
1. Run: ./dockerbak.py
2. Select: Restore from backup
3. Path: ./backups/5_containers_20260101_160000
4. Restore all: No
5. Select: Only database container
6. Current host: Yes
7. Database restored, others skipped
- Read RESTORE_INSTRUCTIONS.md
- Manually create networks
- Manually create volumes
- Manually extract volume data
- Copy/paste docker run commands
- Debug issues
- Time: 15-30 minutes
- Select backup
- Choose target
- Confirm
- Time: 2-5 minutes
Potential features for future versions:
- Restore with configuration modifications
- Scheduled/automated restores
- Restore verification and testing
- Rollback capability
- Multi-target restore (restore to multiple hosts at once)