Benutzer-Werkzeuge

Webseiten-Werkzeuge


knowledge_base:linux:docker:clone-volume

Cloning a Volume

Angelehnt an [https://www.laub-home.de/wiki/Docker_Volume_Rename_-_HowTo|Andread Laub] (in German).

The current docker volume-command has no rename option. This article shows how you can circumvent this restriction to rename a volume anyway. More correctly it copies the contents from one volume to new, correctly named volume and then deletes the old.

Copy the clone-docker-volumes script from alaub's Github.

wget https://raw.githubusercontent.com/alaub81/scripts/master/clone-docker-volumes.sh
chmod +x clone-docker-volumes.sh

this command shows current volumes

docker volume ls
# creates Volume_NEW and copies Volume_OLD to Volume_NEW
clone-docker-volumes.sh volume_OLD volume_NEW

Cleaning up afterwards:

First command shows all volumes that are not assigned to a container.

docker volume ls -f dangling=true
docker volume rm volume_ALT

Done!

/app/www/public/data/pages/knowledge_base/linux/docker/clone-volume.txt · Zuletzt geändert: 2022/06/11 14:35 von julian.lemmerich