Skip to content

Commit d3e3e0a

Browse files
committed
Create rename_docker_volume.yaml
1 parent 7a8a59b commit d3e3e0a

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Rename a Docker volume
3+
command: "docker volume create --name {{new_volume}} && docker run --rm -it -v {{old_volume}}:/from -v {{new_volume}}:/to alpine ash -c 'cd /from ; cp -av . /to' && docker volume rm {{old_volume}}"
4+
tags:
5+
- docker
6+
description: Renames a Docker volume by creating a new volume, copying all of its content to from the old to the new volume and then deletes the old volume.
7+
arguments:
8+
- name: old_volume
9+
description: The name of the old volume
10+
default_value: ~
11+
- name: new_volume
12+
description: The name of the new volume
13+
default_value: ~
14+
source_url: "https://github.com/moby/moby/issues/31154#issuecomment-360531460"
15+
author: Hyruu
16+
author_url: "https://github.com/Hyruu"
17+
shells: []

0 commit comments

Comments
 (0)