You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Docker volumes are created only for images that have the VOLUME instruction, such as 'vault'. For example, if you pull any image that has a volume and run a container from it, the volume will be created automatically. However, when you delete the container from the host, the volume should also be deleted. But docker service is not deleting them automatically, resulting in an increase in file count and ultimately consuming disk space.
To fix this issue, we have to manually clean up from the host (docker volume rm $(docker volume ls -q)), which is not the expected behavior. Docker should manage this internally; whenever an associated container gets deleted, all volumes should also be deleted from the host belongs to deleted containers.
Reproduce
Try to create a container on any image which has VOLUME attached to it (e.g, vault:1.13.3)
Docker run command to create a container (docker run -itd vault:1.13.3)
Now check the docker volume (docker volume ls or docker system df -v), you will see the volume created with size 0B since no file attached to it . but for my case i have own application docker image which has multiple files which large size VOLUME NAME LINKS SIZE 6c2fc8c9a20ebbf4d344aca9b0c72c388188ee36d65eb8fe7afa949fefd49152 0 0B 8e9ceb5c2149cc5077f1d305572d685cdc11de32c74d16e9522aae5a1a08497c 0 2.22GB 2bef84507c17587ecdca16fe24fe7af25f98943c61031a76d44ffecc15c9859e 0 3.215GB
Expected behavior
whenever an associated container gets deleted, all volumes should also be deleted from the host belongs to deleted containers
docker version
[root@ip-10-82-11-35 ec2-user]# docker version
Client:
Version: 20.10.25
API version: 1.41
Go version: go1.20.12
Git commit: b82b9f3
Built: Fri Dec 29 20:37:18 2023
OS/Arch: linux/amd64
Context: default
Experimental: true
Server:
Engine:
Version: 20.10.25
API version: 1.41 (minimum version 1.12)
Go version: go1.20.12
Git commit: 5df983c
Built: Fri Dec 29 20:38:05 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.11
GitCommit: 64b8a811b07ba6288238eefc14d898ee0b5b99ba
runc:
Version: 1.1.11
GitCommit: 4bccb38cc9cf198d52bebf2b3a90cd14e7af8c06
docker-init:
Version: 0.19.0
GitCommit: de40ad0
[root@ip-10-82-11-35 ec2-user]#
OS:
[root@ip-10-82-11-35 ec2-user]# cat /etc/os-release
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
SUPPORT_END="2025-06-30"
[root@ip-10-82-11-35 ec2-user]#
NOTE: I am able to reproduce on other OS and latest version of docker [ubuntu:22.04 and docker version: 1.25]
I am observing the same issue in latest docker version 25.0.3
[root@ip-10-82-8-97 ec2-user]# docker version
Client:
Version: 25.0.3
API version: 1.44
Go version: go1.20.12
Git commit: 4debf41
Built: Mon Feb 12 00:00:00 2024
OS/Arch: linux/amd64
Context: default
This is the expected behavior; docker does not delete volumes by default (even if they are anonymous volumes); the only exception here is when running a container with the --rm option set, which deletes both the container and anonymous volumes associated with it when the container exits; https://docs.docker.com/reference/cli/docker/container/run/#rm
Description
Docker volumes are created only for images that have the VOLUME instruction, such as 'vault'. For example, if you pull any image that has a volume and run a container from it, the volume will be created automatically. However, when you delete the container from the host, the volume should also be deleted. But docker service is not deleting them automatically, resulting in an increase in file count and ultimately consuming disk space.
To fix this issue, we have to manually clean up from the host (docker volume rm $(docker volume ls -q)), which is not the expected behavior. Docker should manage this internally; whenever an associated container gets deleted, all volumes should also be deleted from the host belongs to deleted containers.
Reproduce
VOLUME NAME LINKS SIZE 6c2fc8c9a20ebbf4d344aca9b0c72c388188ee36d65eb8fe7afa949fefd49152 0 0B 8e9ceb5c2149cc5077f1d305572d685cdc11de32c74d16e9522aae5a1a08497c 0 2.22GB 2bef84507c17587ecdca16fe24fe7af25f98943c61031a76d44ffecc15c9859e 0 3.215GB
Expected behavior
whenever an associated container gets deleted, all volumes should also be deleted from the host belongs to deleted containers
docker version
docker info
Additional Info
No response
The text was updated successfully, but these errors were encountered: