docker-volume-toolkit
A small toolkit for Docker volumes. Its first command copies volumes from one name prefix
to another - it matches every volume named {from_prefix}{tail} and copies it to
{to_prefix}{tail}, preserving the tail (_home, _workspace, _certs, a
per-user suffix, anything that follows the prefix). Run it from the host that
owns the Docker volumes; it copies rather than renames, so the originals stay in
place until you have verified the result.
Run with no arguments for the interactive TUI - designer, plan, execution:
Set the FROM and TO prefixes, an optional whole-name filter, the worker count, and the overwrite / remove-source toggles; a live counter shows how many discovered volumes match (5 of 20) and the BEFORE / AFTER panes preview the exact source and destination names.
Review each matched volume and its source → destination mapping; toggle rows with Space (a = all, n = none) and press Enter to run only the selected copies.
Live progress during the copy - an overall bar plus a per-volume bar for each parallel worker, moving through discovery and transfer.
When you need it
Docker namespaces volumes by COMPOSE_PROJECT_NAME (for example myproject_data,
myproject_shared), and many stacks add a per-entity prefix of their own
(jupyterlab-<user>). Whenever that prefix changes you would otherwise lose
access to the existing data:
- renaming a deployment (
COMPOSE_PROJECT_NAMEchange) renames every<old-project>_*volume - an upstream platform reworking its volume names across an upgrade
The migrator moves the data onto the new names so nothing is lost across the rename.
Usage
Run with no arguments for the interactive TUI (designer → plan → execution):
./docker_volume_toolkit.py
Or drive it entirely from the command line:
# preview the mapping without copying
./docker_volume_toolkit.py --from myproject_ --to mynewproject_ --dry-run
# copy, skipping the prompt
./docker_volume_toolkit.py --from myproject_ --to mynewproject_ --yes
# only the cert volumes, four parallel workers
./docker_volume_toolkit.py --from myproject_ --to mynewproject_ --filter '_certs$' --workers 4
Options
--from PREFIXsource volume name prefix (e.g.jupyterlab-)--to PREFIXreplacement destination prefix--filter REGEXregex applied to the full source volume name (empty = all matches)--workers Nparallel copy containers (default 3)--dry-runmount both volumes and verify access, copy nothing--overwriteclean and replace a destination volume that already exists (default: error out and abort)--remove-sourcedelete each source volume after its successful copy (default: keep sources)--yesskip the interactive plan and run from the CLI arguments
How it works
- each copy runs
rsync -aAX --deleteinside a disposablealpinecontainer - source mounted read-only, destination read-write; all metadata preserved - destinations are never recreated - with
--overwritethe existing volume is kept and its contents mirrored from the source (--deleteclears stale files) - sources are left intact by default; after the run the tool prints the
docker volume rmcommands for every volume it copied so you can clean up once verified - the
--filterregex matches the whole source name; note Docker encodes.in volume names as-2e(e.g.alice.smithappears asalice-2esmith)
Install
Needs Docker (the tool shells out to docker volume and docker run) and Python 3.10+;
rich>=13 and textual>=0.80 come with it.
Install from PyPI and run the CLI:
pip install docker-volume-toolkit
docker-volume-toolkit # interactive TUI
docker-volume-toolkit --help # CLI flags
Or skip installation entirely - the script carries an inline dependency block and a
uv run --script shebang, so it auto-installs its own dependencies on first run:
./docker_volume_toolkit.py
Without uv, install the dependencies once and run with any Python:
pip install rich textual
python docker_volume_toolkit.py --help
It copies volumes from one prefix to another, and then it has no further reason to exist. You will run it twice and forget it. The volumes never say thank you.
Metadata
Release files for docker-volume-toolkit 1.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| docker_volume_toolkit-1.2.4.tar.gz | 175.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| docker_volume_toolkit-1.2.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 209.9 kB
Release files / docker_volume_toolkit-1.2.4.tar.gz
| Download URL | docker_volume_toolkit-1.2.4.tar.gz |
|---|---|
| Size | 175.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b99ec2fd095ccfe36acf7928bb965699d5d75dc3ccbe9c62a100aacae5c9aac
|
|
BLAKE2b-256 checksum How to use checksums |
ed8064a306a0df2d62c60cfcbe1cb7a3b91ac43f89a6fbd2c75b15fe8b7e45db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / docker_volume_toolkit-1.2.4-py3-none-any.whl
| Download URL | docker_volume_toolkit-1.2.4-py3-none-any.whl |
|---|---|
| Size | 34.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
244abfed025df31376aeac59d4bf15fd0c1f09f4a5a1dfa480a66b5087f714ca
|
|
BLAKE2b-256 checksum How to use checksums |
7293d0ffaa3f22b6eeab6ed59207c702e67ed3aff9401da4ee5bcf9087d5e251
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|