docker-volume-toolkit 1.2.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- docker_volume_toolkit-1.2.2.dist-info/METADATA +139 -0
- docker_volume_toolkit-1.2.2.dist-info/RECORD +6 -0
- docker_volume_toolkit-1.2.2.dist-info/WHEEL +4 -0
- docker_volume_toolkit-1.2.2.dist-info/entry_points.txt +2 -0
- docker_volume_toolkit-1.2.2.dist-info/licenses/LICENSE +21 -0
- migrate_volumes.py +1699 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: docker-volume-toolkit
|
|
3
|
+
Version: 1.2.2
|
|
4
|
+
Summary: Docker volume toolkit - copy/migrate volumes across a name-prefix change (CLI + interactive TUI)
|
|
5
|
+
Project-URL: Homepage, https://github.com/stellarshenson/docker-volume-toolkit
|
|
6
|
+
Project-URL: Repository, https://github.com/stellarshenson/docker-volume-toolkit
|
|
7
|
+
Project-URL: Issues, https://github.com/stellarshenson/docker-volume-toolkit/issues
|
|
8
|
+
Author-email: stellarshenson <konrad.jelen@gmail.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: cli,devops,docker,migration,rsync,toolkit,tui,volume
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: System Administrators
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: System :: Systems Administration
|
|
23
|
+
Classifier: Topic :: Utilities
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Requires-Dist: rich>=13
|
|
26
|
+
Requires-Dist: textual>=0.80
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# docker-volume-toolkit
|
|
30
|
+
|
|
31
|
+
[](https://pypi.org/project/docker-volume-toolkit/)
|
|
32
|
+
[](https://pepy.tech/project/docker-volume-toolkit)
|
|
33
|
+
[](https://www.python.org/downloads/)
|
|
34
|
+
[](LICENSE)
|
|
35
|
+
|
|
36
|
+
A small toolkit for Docker volumes. Its first command copies volumes from one name prefix
|
|
37
|
+
to another - it matches every volume named `{from_prefix}{tail}` and copies it to
|
|
38
|
+
`{to_prefix}{tail}`, preserving the tail (`_home`, `_workspace`, `_certs`, a
|
|
39
|
+
per-user suffix, anything that follows the prefix). Run it from the host that
|
|
40
|
+
owns the Docker volumes; it copies rather than renames, so the originals stay in
|
|
41
|
+
place until you have verified the result.
|
|
42
|
+
|
|
43
|
+
Run with no arguments for the interactive TUI - designer, plan, execution:
|
|
44
|
+
|
|
45
|
+

|
|
46
|
+
|
|
47
|
+
*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.*
|
|
48
|
+
|
|
49
|
+

|
|
50
|
+
|
|
51
|
+
*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.*
|
|
52
|
+
|
|
53
|
+

|
|
54
|
+
|
|
55
|
+
*Live progress during the copy - an overall bar plus a per-volume bar for each parallel worker, moving through discovery and transfer.*
|
|
56
|
+
|
|
57
|
+
## When you need it
|
|
58
|
+
|
|
59
|
+
Docker namespaces volumes by `COMPOSE_PROJECT_NAME` (for example `myproject_data`,
|
|
60
|
+
`myproject_shared`), and many stacks add a per-entity prefix of their own
|
|
61
|
+
(`jupyterlab-<user>`). Whenever that prefix changes you would otherwise lose
|
|
62
|
+
access to the existing data:
|
|
63
|
+
|
|
64
|
+
- renaming a deployment (`COMPOSE_PROJECT_NAME` change) renames every
|
|
65
|
+
`<old-project>_*` volume
|
|
66
|
+
- an upstream platform reworking its volume names across an upgrade
|
|
67
|
+
|
|
68
|
+
The migrator moves the data onto the new names so nothing is lost across the
|
|
69
|
+
rename.
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
Run with no arguments for the interactive TUI (designer → plan → execution):
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
./migrate_volumes.py
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Or drive it entirely from the command line:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# preview the mapping without copying
|
|
83
|
+
./migrate_volumes.py --from myproject_ --to mynewproject_ --dry-run
|
|
84
|
+
|
|
85
|
+
# copy, skipping the prompt
|
|
86
|
+
./migrate_volumes.py --from myproject_ --to mynewproject_ --yes
|
|
87
|
+
|
|
88
|
+
# only the cert volumes, four parallel workers
|
|
89
|
+
./migrate_volumes.py --from myproject_ --to mynewproject_ --filter '_certs$' --workers 4
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Options
|
|
93
|
+
|
|
94
|
+
- `--from PREFIX` source volume name prefix (e.g. `jupyterlab-`)
|
|
95
|
+
- `--to PREFIX` replacement destination prefix
|
|
96
|
+
- `--filter REGEX` regex applied to the full source volume name (empty = all matches)
|
|
97
|
+
- `--workers N` parallel copy containers (default 3)
|
|
98
|
+
- `--dry-run` mount both volumes and verify access, copy nothing
|
|
99
|
+
- `--overwrite` clean and replace a destination volume that already exists (default: error out and abort)
|
|
100
|
+
- `--remove-source` delete each source volume after its successful copy (default: keep sources)
|
|
101
|
+
- `--yes` skip the interactive plan and run from the CLI arguments
|
|
102
|
+
|
|
103
|
+
## How it works
|
|
104
|
+
|
|
105
|
+
- each copy runs `rsync -aAX --delete` inside a disposable `alpine` container - source mounted read-only, destination read-write; all metadata preserved
|
|
106
|
+
- destinations are never recreated - with `--overwrite` the existing volume is kept and its contents mirrored from the source (`--delete` clears stale files)
|
|
107
|
+
- sources are left intact by default; after the run the tool prints the `docker volume rm` commands for every volume it copied so you can clean up once verified
|
|
108
|
+
- the `--filter` regex matches the whole source name; note Docker encodes `.` in volume names as `-2e` (e.g. `alice.smith` appears as `alice-2esmith`)
|
|
109
|
+
|
|
110
|
+
## Install
|
|
111
|
+
|
|
112
|
+
Needs Docker (the tool shells out to `docker volume` and `docker run`) and Python 3.10+;
|
|
113
|
+
`rich>=13` and `textual>=0.80` come with it.
|
|
114
|
+
|
|
115
|
+
Install from PyPI and run the CLI:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
pip install docker-volume-toolkit
|
|
119
|
+
docker-volume-toolkit # interactive TUI
|
|
120
|
+
docker-volume-toolkit --help # CLI flags
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Or skip installation entirely - the script carries an inline dependency block and a
|
|
124
|
+
`uv run --script` shebang, so it auto-installs its own dependencies on first run:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
./migrate_volumes.py
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Without `uv`, install the dependencies once and run with any Python:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
pip install rich textual
|
|
134
|
+
python migrate_volumes.py --help
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
*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.*
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
migrate_volumes.py,sha256=a-bQ1omg7bY4hSmchLAY9f7XYhm78O4oxayRjOdC62o,66689
|
|
2
|
+
docker_volume_toolkit-1.2.2.dist-info/METADATA,sha256=YYANZfBKbRjqUvHfgyjrPaKIMzQoQVgMgFnBNEmXapA,6084
|
|
3
|
+
docker_volume_toolkit-1.2.2.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
4
|
+
docker_volume_toolkit-1.2.2.dist-info/entry_points.txt,sha256=qMFIEgemQwRvdUWQrr1cPz_iVnEhFoq1blnhDyRfeMA,63
|
|
5
|
+
docker_volume_toolkit-1.2.2.dist-info/licenses/LICENSE,sha256=Q0VIzsSTiDhy0bd1LaeT6sULVZ-cZ3k9zhI2pFkZkm0,1071
|
|
6
|
+
docker_volume_toolkit-1.2.2.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 stellarshenson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|