User Tools

Site Tools


docker:remove_a_volume

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
docker:remove_a_volume [2020/04/15 22:07] – created peterdocker:remove_a_volume [2020/05/13 08:53] (current) – removed peter
Line 1: Line 1:
-====== Docker - Remove a volume ====== 
- 
-===== Remove one or more specific volumes - Docker 1.9 and later ===== 
- 
-Use the **docker volume ls** command to locate the volume name or names you wish to delete. 
- 
-Then you can remove one or more volumes with the **docker volume rm** command: 
- 
-To list the volumes: 
- 
-<code bash> 
-docker volume ls 
-</code> 
- 
- 
-To remove the volumes: 
- 
-<code bash> 
-docker volume rm volume_name volume_name 
-</code> 
- 
----- 
- 
-===== Remove dangling volumes - Docker 1.9 and later ===== 
- 
-Since the point of volumes is to exist independent from containers, when a container is removed, a volume is not automatically removed at the same time. 
- 
-When a volume exists and is no longer connected to any containers, however, it's called a dangling volume. 
- 
-To locate them to confirm you want to remove them, you can use the **docker volume ls** command with a filter to limit the results to dangling volumes. 
- 
-When you're satisfied with the list, you can add a **-q** flag to provide the volume name to **docker volume rm**: 
- 
-To list the volumes: 
- 
-<code bash> 
-docker volume ls -f dangling=true 
-</code> 
- 
-To remove the volumes: 
- 
-<code bash> 
-docker volume rm $(docker volume ls -f dangling=true -q) 
-</code> 
- 
----- 
- 
-===== Remove a container and its volume ===== 
- 
-If you created an unnamed volume, it can be deleted at the same time as the container with the **-v** flag. 
- 
-Note that this only works with unnamed volumes. 
- 
-When the container is successfully removed, its ID is displayed. 
- 
-Note that no reference is made to the removal of the volume. 
- 
-If it is unnamed, it is silently removed from the system. 
- 
-If it is named, it silently stays present. 
- 
-To remove: 
- 
-<code bash> 
-docker rm -v container_name 
-</code> 
  
docker/remove_a_volume.1586988452.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki