cli icon indicating copy to clipboard operation
cli copied to clipboard

Reclaimable image size can not be reclaimed after "docker system prune -a"

Open bysnupy opened this issue 5 years ago • 10 comments

Description

The size under RECLAIMABLE column has not been reclaimed by docker system prune -a. The size was not changed, even though no size is reclaimed. How to be calculated the RECALIMABLE size ? How to make the reclaimable size to 0% ?

And is docker system prune -a safe for running containers ?

# docker system df
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              22                  21                  6.665 GB            1.642 GB (24%)
Containers          54                  53                  301.2 MB            0 B (0%)
Local Volumes       2                   2                   1.459 GB            0 B (0%)

# docker system prune 
WARNING! This will remove:
    - all stopped containers
    - all volumes not used by at least one container
    - all networks not used by at least one container
    - all dangling images
Are you sure you want to continue? [y/N] y
Deleted Containers:
5598c73d725e4236d4df45cda6d4e75d444e51b0f72c447bfce5c793f9712345

Deleted Volumes:
aa8c141f6efa09475c93c20e8c45005bac8f8d643eed5c404cdd142e998dd329

Total reclaimed space: 0 B

# docker system prune -a
WARNING! This will remove:
    - all stopped containers
    - all volumes not used by at least one container
    - all networks not used by at least one container
    - all images without at least one container associated to them
Are you sure you want to continue? [y/N] y
Total reclaimed space: 0 B

Describe the results you received: Not to be 0% of the reclaimable size, even though docker system prune can not remove unused images any more.

Describe the results you expected: Reclaimable size would be 0% after docker system prune.

Output of docker version:

# docker version
Client:
 Version:         1.13.1
 API version:     1.26
 Package version: docker-1.13.1-88.git07f3374.el7.x86_64
 Go version:      go1.10.2
 Git commit:      07f3374/1.13.1
 Built:           Thu Dec  6 07:01:49 2018
 OS/Arch:         linux/amd64

Server:
 Version:         1.13.1
 API version:     1.26 (minimum version 1.12)
 Package version: docker-1.13.1-88.git07f3374.el7.x86_64
 Go version:      go1.10.2
 Git commit:      07f3374/1.13.1
 Built:           Thu Dec  6 07:01:49 2018
 OS/Arch:         linux/amd64
 Experimental:    false

bysnupy avatar Mar 18 '19 13:03 bysnupy

FYI, I've verified for this issue.

I'm not sure yet after testing, but in my conclusion, it seems the RECLAIMABLE size is affected by shared size of images which are referred by running containers.

  • Testing Result summary:

    • If images are used by containers, their images should be 0% reclaimable in my knowledge, but it's not 0% even though all images are referring by running containers.
    • Additionally the reclaimable size can not reclaim using docker system prune -a, it seems just potential reclaimable size when some conditions are met.
  • My personal conclusion

    • So RECLAIMABLE size is not meaning real reclaimable size.

I did not(can not) check the image hierarchy details, but RECLAMABLE size was same with SHARED SIZE of container image. Even though the images were referred by running containers. So they were not dangling images and unused images. In my knowledge of docker image pruning, RECLAIMABLE size should be 0, but it shows 223.7 MB.

After delete the running containers which are using the images, RECLAIMABLE size became 100%, it's a expected result.

It's my testing evidence.

# docker system df 
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              2                   2                   1.183 GB            223.7 MB (18%)
Containers          4                   4                   40.92 kB            0 B (0%)
Local Volumes       0                   0                   0 B                 0 B

# docker system prune 
WARNING! This will remove:
	- all stopped containers
	- all volumes not used by at least one container
	- all networks not used by at least one container
	- all dangling images
Are you sure you want to continue? [y/N] y
Total reclaimed space: 0 B

# docker system prune -a
WARNING! This will remove:
	- all stopped containers
	- all volumes not used by at least one container
	- all networks not used by at least one container
	- all images without at least one container associated to them
Are you sure you want to continue? [y/N] y
Total reclaimed space: 0 B


# docker system df  -v
Images space usage:

REPOSITORY                       TAG                 IMAGE ID            CREATED             SIZE                SHARED SIZE         UNIQUE SIZE         CONTAINERS
docker.hub.io/test/someimage1    v3.11.59            9f079b2768e8        3 months ago        1.169 GB            223.7 MB            945.3 MB            1
docker.hub.io/test/someimage2    v3.11.59            e1587dbd0def        3 months ago        238.1 MB            223.7 MB            14.47 MB            3

# docker system df 
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              2                   2                   1.183 GB            223.7 MB (18%)
Containers          4                   4                   40.92 kB            0 B (0%)
Local Volumes       0                   0                   0 B                 0 B

# docker rm 85425bf1f16d d7c442750e17 daa874b028a3 491b2acf4eb9 -f
85425bf1f16d
d7c442750e17
daa874b028a3
491b2acf4eb9

# docker system df 
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              2                   0                   1.183 GB            1.183 GB (100%)
Containers          0                   0                   0 B                 0 B
Local Volumes       0                   0                   0 B                 0 B

bysnupy avatar Mar 23 '19 02:03 bysnupy

This applies to the latest release as well. RECLAIMABLE is badly named.

yoctozepto avatar Nov 05 '19 08:11 yoctozepto

TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              2                   2                   1.183 GB            223.7 MB (18%)
Containers          4                   4                   40.92 kB  

Additionally, how it it even possible to have 1.183GB of images and only 40.92kB size? 2 Images, 4 containers. (In my system, 23 images 5.842GB and 23 containers 285MB - not what portainer is showing either.) How can that space be reclaimed?

DavidFW1960 avatar Jan 06 '20 01:01 DavidFW1960

@DavidFW1960 As far as I know, Containers means container layers, so it's different layers with base images. Refer here https://docs.docker.com/v17.09/engine/userguide/storagedriver/imagesandcontainers/#images-and-layers for more details.

bysnupy avatar Jan 06 '20 02:01 bysnupy

Thanks for that. Good info.

TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              23                  23                  5.842GB             720.5MB (12%)
Containers          23                  23                  285MB               0B (0%)
Local Volumes       0                   0                   0B                  0B
Build Cache         0                   0                   0B                  0B

I'd love to be able to reclaim that 720mb...

DavidFW1960 avatar Jan 06 '20 03:01 DavidFW1960

Same for me:

$ docker system df
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              40                  40                  13.03GB             3.902GB (29%)
Containers          89                  88                  244.5MB             0B (0%)
Local Volumes       10                  10                  0B                  0B
Build Cache         0                   0                   0B                  0B

$ docker version
Client: Docker Engine - Community
 Version:           19.03.13
 API version:       1.40
 Go version:        go1.13.15
 Git commit:        4484c46d9d
 Built:             Wed Sep 16 17:02:36 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.13
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       4484c46d9d
  Built:            Wed Sep 16 17:01:06 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.3.7
  GitCommit:        8fba4e9a7d01810a393d5d25a3621dc101981175
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

msschl avatar Oct 18 '20 14:10 msschl

@DavidFW1960 @msschl If you want to free some image space you need to run docker rmi and get rid of some old image version you're not using anymore.

giorgiopers avatar Jan 05 '21 11:01 giorgiopers

Have you tried docker image prune -a?

ChristianStadelmann avatar Feb 16 '21 10:02 ChristianStadelmann

There is no change. Even though all images are active, but some parts of the images are calculated in the reclaimable size. It's confused.

# docker system df
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              8                   8                   2.221 GB            990 MB (44%)
Containers          23                  18                  105.4 MB            0 B (0%)
Local Volumes       0                   0                   0 B                 0 B

# docker image prune -a
WARNING! This will remove all images without at least one container associated to them.
Are you sure you want to continue? [y/N] y
Total reclaimed space: 0 B

bysnupy avatar Feb 18 '21 08:02 bysnupy

I'm running into the same issue. This is so strange.

$ sudo docker system df
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          21        21        14.31GB   2.21GB (15%)
Containers      63        63        0B        0B
Local Volumes   132       132       3.387GB   0B (0%)
Build Cache     0         0         0B        0B

$ sudo docker system prune -a
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all images without at least one container associated to them
  - all build cache

Are you sure you want to continue? [y/N] y
Total reclaimed space: 0B

d19dotca avatar Apr 06 '24 07:04 d19dotca