Docker Community Forums

Share and learn in the Docker community.

How to shrink docker folder


(Condescendent) #1

how could I clean my hard drive for the docker server. I have a docker server which hosts 4 containers, but they maxed out the volume. I would like to know how I can shrink the docker folder without itnerupting the running containers.

thanks.

[root@docker docker]# ls -alth
total 20K
drwxr-xr-x. 29 root root 4.0K May 30 03:40 …
drwx------. 50 root root 4.0K May 4 19:15 volumes
drwx------. 21 root root 4.0K May 4 19:15 containers
drwx------. 2 root root 6 May 4 19:13 tmp
drwx------. 5 root root 50 Nov 2 2016 devicemapper
drwx–x--x. 10 root root 4.0K Nov 2 2016 .
drwx------. 2 root root 6 Nov 2 2016 swarm
drwxr-x—. 3 root root 18 Nov 2 2016 network
drwx------. 2 root root 6 Nov 2 2016 trust
drwx------. 3 root root 25 Nov 2 2016 image
[root@docker docker]# du --max-depth=1 -h . | sort -n -r
364K ./volumes
72K ./network
49G .
43G ./containers
9.1M ./image
6.6G ./devicemapper
0 ./trust
0 ./tmp
0 ./swarm
[root@docker docker]#

[root@docker docker]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
71ee5fa518a0 kafka-websocket “/bin/sh -c 'java -ja” 4 months ago Up 4 months 0.0.0.0:7080->7080/tcp kafka-websocket
f2736544c212 confluentinc/cp-zookeeper:3.2.1 “/etc/confluent/docke” 4 months ago Up 4 months 2181/tcp, 2888/tcp, 3888/tcp, 0.0.0.0:32181->32181/tcp zookeeper
65f3f4fef5d9 jorith88/dotcms-bootcamp-dotcms “/opt/dotcms/start-do” 10 months ago Up 10 months 8009/tcp, 8080/tcp jason_dotcms
dbb36826dff9 jorith88/dotcms-bootcamp-db “/docker-entrypoint.s” 10 months ago Up 10 months 5432/tcp gloomy_bhabha
[root@docker docker]#


(Think) #2

have you tried docker system prune -af?


(Junius) #3

You could try to delete the obsolete images and containers. While, if the node only has 4 containers running, probably not help much.

How does the container persist the data? If the container, such as Kafka, directly stores data on the local host, it is likely Kafka’s data is consuming the disk. You should have separate volume for Kafka container.