To Reduce the Data Area of the docker

Asked 2 years ago, Updated 2 years ago, 59 views

CentOS Linux release 7.3.1611(Core)
Docker version 1.12.6, build3a094bd/1.12.6

is used.
The disk space was full, so I checked and found that the docker's data area was large.

$cd/var/lib/docker/devicemapper/devicemapper/
$ ls-l
Total 9966968
-rw ----------- 1 root root 107374182400 January 17:13 data
-rw ----------- 1 root root 2147483648 January 17 17:10 metadata

I have deleted (docker rmi) the images of docker, but it seems to be ineffective.
I also found docker system prune online, but

#docker system prune
docker: 'system' is not a docker command.
See'docker --help'.

I don't know if it's because the docker version is low, but there seems to be no command.

What should I do to reduce the data area of docker?Please let me know if you know.

centos docker

2022-09-29 20:27

1 Answers

When docker system prune was not present, the following commands removed unnecessary items:

  • Delete untagged image

    docker rmi$(docker images-qf dangling=true)

  • Delete Stopped Container

    docker rm$(docker ps-a-q)

  • Delete Unlinked Volume

Delete untagged images

docker rmi$(docker images-qf dangling=true)

Delete Stopped Containers

docker rm$(docker ps-a-q)

US>Delete Unlinked Volumes

not tied to containers

Remove volumes that are not tied to the container.
Note that even the required volume must be removed if the container is not up.

docker volume $(docker volumes-qf dancing=true)


2022-09-29 20:27

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.