A single-file Python app that compares two Docker hosts (reachable over SSH) and lets you copy containers/images and volumes from one to the other with a friendly GUI.
- Query both hosts for:
- Containers (all, running or stopped)
- Volumes
- Swarm stacks and Compose projects (beta: discovery only)
- Show diffs and preselect items missing on destination
- Copy volumes safely using an Alpine helper container and tar streaming over SSH
- Copy required images for selected containers (docker save|load piped over SSH)
- Recreate containers on the destination (name, env, ports, binds, restart policy, networks) and optionally start them
- Optionally stop selected containers on the source during copy and restart them after
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python docker_migrator.pyOn Windows PowerShell:
py -3 -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
py docker_migrator.py- Python 3.10+
- Docker installed and running on both hosts
- SSH access (password or key); the user must be able to run
docker(often viadockergroup or sudo-less) - Internet on both hosts to
docker pull alpine:latestif not present
- Volumes: We avoid touching
/var/lib/docker/.... Instead we run:- Source:
docker run --rm -v VOL:/data alpine tar -C /data -cf - . - Destination:
docker run --rm -i -v VOL:/data alpine tar -C /data -xf - - We stream stdout from source to stdin on destination over SSH.
- Source:
- Images: We transfer missing images with
docker image save ... | gzippiped intogunzip | docker image load. - Containers: We
docker inspecton the source, thendocker createon the destination with env, ports, binds, restart policy, and networks (bridge auto, others created if missing). We then optionallydocker startit.
Note: If containers bind mount host paths (e.g.,
/srv/data:/data), ensure those paths exist on the destination or convert them to named volumes first.
We detect Swarm stacks (docker stack ls) and Compose projects (docker compose ls) but automated redeploy is limited in this version. We transfer images used by stack services; to redeploy, run your original docker stack deploy or docker compose up on the destination. Future versions may attempt to reconstruct compose files from service/container inspections, but fidelity can vary.
- Optionally stop source containers during copy to avoid inconsistent state
- Volume transfer uses tar; consider stopping services that write to volumes during migration
- You can restart source containers after copying completes
- Permission errors: Ensure SSH user can run
dockerwithout sudo, or adapt the code to prefix commands withsudo. - Network timeouts: Large images/volumes can take time. The stream is chunked and progress is logged at ~10MB intervals.
- Non-default networks: The tool creates missing user-defined networks by name on the destination and connects containers.
- Full stack/compose export + redeploy
- Smarter mapping of host bind mounts
- Progress bars per item
- Inclusion/exclusion filters by label