Open coding-to-music opened 3 years ago
sudo du -h / -d 1
sudo du -h /var -d 1
sudo du -h /var/lib -d 1
sudo du -h /var/lib/docker -d 1
sudo du -h /var/lib/docker/overlay2 -d 1
df -h
docker image list
docker system df
docker container list
docker image help
docker image prune
df -h
docker volume ls
docker volume help
# Prune unused volumes
docker volume prune
# Prune images that now are unneeded, not connected to volumes or containers
docker image prune -a
df -h
root@docker-ubuntu-s-1vcpu-2gb-nyc1-01:/dev# docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 19 11 11.26GB 7.329GB (65%)
Containers 19 3 9.892GB 9.892GB (99%)
Local Volumes 9 9 1.9GB 0B (0%)
Build Cache 0 0 0B 0B
Images space usage:
REPOSITORY TAG IMAGE ID CREATED SIZE SHARED SIZE UNIQUE SIZE CONTAINERS
<none> <none> 1762654b3180 13 hours ago 453.2MB 452.9MB 286.9kB 2
my_image latest 34c1cd80b6e2 25 hours ago 104.4MB 72.78MB 31.62MB 2
digitalocean.com/php latest 9ddf33f78939 47 hours ago 739.2MB 398.1MB 341.2MB 1
ghcr.io/redisgrafana/redis-app latest ff95faa24fa4 6 days ago 462.9MB 72.78MB 390.1MB 1
ghcr.io/redisgrafana/redis-prophet latest fd771a7dde79 6 days ago 2.378GB 0B 2.378GB 2
php 7.3-fpm 4c013e5980cf 7 days ago 452.9MB 452.9MB 0B 0
php 7.4-fpm 2cd6c3eedab2 7 days ago 459.6MB 349.4MB 110.2MB 0
influxdb 2.0.8 d0eb1991d5e6 12 days ago 344.6MB 150.9MB 193.8MB 0
composer latest aa855c271386 2 weeks ago 175.6MB 5.595MB 170MB 0
nginx alpine 7ce0143dee37 2 weeks ago 22.85MB 5.595MB 17.25MB 1
ubuntu latest 1318b700e415 4 weeks ago 72.78MB 72.78MB 0B 0
influxdb 2.0.7 d636ad7ee210 4 weeks ago 351.3MB 150.9MB 200.4MB 2
redis latest aa4d65e670d6 4 weeks ago 105.4MB 0B 105.4MB 2
wasmedge/wasmedge latest f187da719e71 7 weeks ago 1.794GB 0B 1.794GB 0
secondstate/wasmedge-nodejs-starter latest 6c06772ea943 7 weeks ago 3.981GB 0B 3.981GB 0
hello-world latest d1165f221234 5 months ago 13.34kB 0B 13.34kB 1
php 7.2-fpm 28f52b60203d 8 months ago 398.1MB 398.1MB 0B 0
redis 5.0.3 0f88f9be5839 2 years ago 94.98MB 0B 94.98MB 1
mysql 5.7.22 6bb891430fb6 3 years ago 371.9MB 0B 371.9MB 1
Containers space usage:
CONTAINER ID IMAGE COMMAND LOCAL VOLUMES SIZE CREATED STATUS NAMES
00fdc1d4489e 1762654b3180 "/bin/sh -c 'apt-get…" 0 17.6MB 13 hours ago Exited (100) 13 hours ago eloquent_dirac
95f3a5b1f0c7 1762654b3180 "/bin/sh -c 'apt-get…" 0 17.6MB 13 hours ago Exited (100) 13 hours ago relaxed_stonebraker
b51f732a1a67 0da505c998bd "/bin/sh -c 'docker-…" 0 135MB 13 hours ago Exited (1) 13 hours ago busy_jepsen
a0713609394f 0da505c998bd "/bin/sh -c 'docker-…" 0 135MB 13 hours ago Exited (1) 13 hours ago hopeful_raman
df4bb614c63a f36763b5ac7c "/bin/sh -c 'docker-…" 0 118MB 13 hours ago Exited (1) 13 hours ago vibrant_gagarin
0b7ae0932a11 my_image "ping service-1 -c 3" 0 0B 25 hours ago Exited (0) 25 hours ago service-2
ca2a0ec78102 my_image "ping service-2 -c 3" 0 0B 25 hours ago Exited (0) 25 hours ago service-1
2c88abbac5a7 digitalocean.com/php "docker-php-entrypoi…" 0 0B 47 hours ago Up 13 hours app
28474849408f mysql:5.7.22 "docker-entrypoint.s…" 1 2B 47 hours ago Up 47 hours db
841a60bf76c4 nginx:alpine "/docker-entrypoint.…" 0 2B 47 hours ago Up 14 hours webserver
3957f5e05661 ghcr.io/redisgrafana/redis-prophet:latest "redis-server --load…" 1 9.13GB 6 days ago Exited (0) 14 hours ago redis
04386c1b7cf3 ghcr.io/redisgrafana/redis-prophet:latest "redis-server --load…" 1 339MB 6 days ago Exited (0) 6 days ago redis-prophet
64639d5daaa1 ghcr.io/redisgrafana/redis-app:latest "/run.sh" 0 690kB 6 days ago Exited (0) 14 hours ago grafana
f3e78730699e redis "docker-entrypoint.s…" 1 0B 8 days ago Exited (0) 8 days ago some-redis2
456c111a7a9d redis "docker-entrypoint.s…" 1 0B 8 days ago Exited (0) 8 days ago some-redis
581c99ab953b redis:5.0.3 "docker-entrypoint.s…" 1 0B 9 days ago Exited (137) 8 days ago redis5-under-the-hood
b1744742d827 influxdb:2.0.7 "/entrypoint.sh infl…" 2 0B 2 weeks ago Exited (0) 2 weeks ago eager_moser
14a42001263b influxdb:2.0.7 "/entrypoint.sh infl…" 1 0B 2 weeks ago Exited (0) 2 weeks ago influxdb
6abf3f155407 hello-world "/hello" 0 0B 8 weeks ago Exited (0) 8 weeks ago stoic_moore
Local Volumes space usage:
VOLUME NAME LINKS SIZE
0cbe045a760936bc325c9ea860e5c8abb79128198af2dc3dd05f8c9335e82f16 1 1.338GB
6d5820d3ae24dd40fdad0568800a269315f172558644ef5f1d343b71527e25a6 1 663B
f2624b757bbd98429a47178b3b8fd172bb6aa36238261eaaff061ff4ad12c1e5 1 65.54kB
5ce7099f06d04fdfc5bb52b8593e1443f4fb3b890e6028af7f884ea6958e9f5c 1 92B
laravel-app_dbdata 1 226.5MB
b86217fb64e141d1f230ef02c16d3e21a60668329e43738d16c65b44c0330dab 1 334.6MB
24187a11d7197fd8889d0d5f973bc27a7978866666d02635c098043bdd14b69d 1 92B
70f4a7322ac5c843fc72ec112319b7eebee085cdc0f216d8c8c14f3fc6300197 1 0B
c77d9eb21bc4cef0fffe1b830828388e2c052f0385007ae1b37de46a8a9ee420 1 0B
Build cache usage: 0B
CACHE ID CACHE TYPE SIZE CREATED LAST USED USAGE SHARED
April 13, 2020 Patrick Tutorials 1
https://codeopolis.com/posts/simple-commands-to-clean-up-docker/
Introduction
Working with Docker can get messy, especially if you are working with it daily. If you’re like me, you are working with multiple applications and creating multiple volumes for each application. It would be nice if there was a simple way to clean up docker. Below are the commands needed to easily clean up unused docker containers, images, volumes, and networks.
Clean up Unused Docker Containers Portainer Screenshot of unused Docker containers When you stop a docker container it sits on the host system just in case you want to use it again. You can choose to delete these containers individually or you can run the following command in your terminal to delete them all at once.
docker container prune
root@docker-ubuntu-s-1vcpu-2gb-nyc1-01:~/ap/prune-docker# docker container prune
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
Deleted Containers:
00fdc1d4489e721d33da3de237e6df6d2e86022a45261ba58209f1a039ad422e
95f3a5b1f0c784d9fb8691d8081e31ef9881d3c82ce80860b4b6e87abf9a2988
b51f732a1a6785089d3d493b3fab965756870aa5a510744c9ca4f663ae93f741
a0713609394f954396feb75293967397f96c798ae022004d6c270c62409b856b
df4bb614c63a995ffbb1fb51352cb39be4f9c1c9a76874c1c2c0f8d0a5077788
0b7ae0932a119df21cb8f1ccd656aff0bc107970482720b0614574bbdc6a6e55
ca2a0ec78102c4d3d8aeef00e663e9b5c41442c788d275ec5c04e61c4f3da142
3957f5e05661d74ea0d85e923cf25c92c52e48c9727ef604ddad3274b5bc46bc
04386c1b7cf3a9232dbf4c5504f70c55a3f75deedcc4b1b298e09430f103c659
64639d5daaa1bad6438b12764cedf1284bff3e6a82f0f1b274d119cb6bcda6c7
f3e78730699ebf391dfbb4559b962e022fcd5b5f1c191045cb990ab786380a56
456c111a7a9d3656def3d8a52191373b26d4f05e0e4f7472069b5d301d38180b
581c99ab953b96fbd6c28a86fdde58678d1ea7dde0e11f408842bfe4224db386
b1744742d8277ea75983925a0d75e1b49001a0c2a32455d7c8515c990b86226a
14a42001263b7511d25e1f7f2690b96f032eca11970e77fa2b524986046c211d
6abf3f155407f17cdaa6a882fdffd20d78ff53d70f525bc8e3470c55cd067907
Total reclaimed space: 9.892GB
After you hit the enter key, you’ll get the following warning:
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N]
Typing y and hitting enter will proceed with removing all your unused docker containers. You’ll then get a nice notification that informs you of how much space you saved by pruning your containers.
Unused Docker Images
Portainer screenshot of unused docker images.
In some situations, unused images can pile up quicker than unused containers. This is especially true if you are using Ouroboros or Watchtower to automatically update your running containers and have them set to leave the previous images so you can revert back to one of those images if an update breaks one of your running applications. Images can also pile up quickly if you’ve been browsing the Docker Hub or experimenting with the latest docker images from Linuxserver.io.
To delete all of your unused images at once, you can run the following command in terminal:
docker image prune
root@docker-ubuntu-s-1vcpu-2gb-nyc1-01:~/ap/prune-docker# docker image prune
WARNING! This will remove all dangling images.
Are you sure you want to continue? [y/N] y
Deleted Images:
deleted: sha256:1762654b31809d3f8636f3ee5030a5744361488306d628d5b68c6f17345da9b2
deleted: sha256:edd3a7e08da66a20f96358da1f903e88df21ab68ea72191b5e79ceb1fb3d5c58
deleted: sha256:8cf02b337e81bcb8bc6609bd9bdd9a63c72f03e2b2225ca6525455d33a355d3e
Total reclaimed space: 286.9kB
When you run this command you’ll be asked to verify that you want to delete all of your dangling images.
WARNING! This will remove all dangling images.
Are you sure you want to continue? [y/N]
Type y and hit enter, and you’ll be greeted with a satisfying message on how much space you just saved.
If you are storing your persistent volume data on your host machine instead of a network file share then the unused volumes on your system can take up a lot of space. Although some volumes are created manually, some containers automatically create volumes when they initially startup. If you delete those containers, the volumes will remain on the system. You can clean up docker volumes by running the following command in your terminal:
docker volume prune
root@docker-ubuntu-s-1vcpu-2gb-nyc1-01:~/ap/prune-docker# docker volume prune
WARNING! This will remove all local volumes not used by at least one container.
Are you sure you want to continue? [y/N] y
Deleted Volumes:
b86217fb64e141d1f230ef02c16d3e21a60668329e43738d16c65b44c0330dab
24187a11d7197fd8889d0d5f973bc27a7978866666d02635c098043bdd14b69d
70f4a7322ac5c843fc72ec112319b7eebee085cdc0f216d8c8c14f3fc6300197
c77d9eb21bc4cef0fffe1b830828388e2c052f0385007ae1b37de46a8a9ee420
0cbe045a760936bc325c9ea860e5c8abb79128198af2dc3dd05f8c9335e82f16
6d5820d3ae24dd40fdad0568800a269315f172558644ef5f1d343b71527e25a6
f2624b757bbd98429a47178b3b8fd172bb6aa36238261eaaff061ff4ad12c1e5
5ce7099f06d04fdfc5bb52b8593e1443f4fb3b890e6028af7f884ea6958e9f5c
Total reclaimed space: 1.673GB
Once you hit enter, you’ll be asked if you are sure…
WARNING! This will remove all local volumes not used by at least one container.
Are you sure you want to continue? [y/N]
Type y and hit enter and you’re good to go!
Unused docker networks do not take up much space on your system but can annoy those who like to keep a tidy docker host. If you want to display all of your docker networks, type the following command:
docker network ls
root@docker-ubuntu-s-1vcpu-2gb-nyc1-01:~/ap/prune-docker# docker network ls
NETWORK ID NAME DRIVER SCOPE
6a7bf7c8742e bridge bridge local
4594912907d8 host host local
566db84d5979 laravel-app_app-network bridge local
3912eb0b52e4 none null local
8408cb5f5d42 ping-docker-compose_default bridge local
941a74313d81 redis-finance-prophet_default bridge local
Once you hit enter you’ll be presented with all of the networks created on your docker host.
NETWORK ID NAME DRIVER SCOPE
2
5aefeb6a2076 Main bridge local
3
0dd9f0b8e326 bridge bridge local
4
e7ce4bb22108 docker_gwbridge bridge local
5
f19e16a3c5c6 host host local
6
osinb3qa6ylq ingress overlay swarm
7
bf21813c5f46 none null local
In order to clean up docker networks that are not in use by a container then type the following command:
docker network prune
You’ll be asked if you would like to continue:
WARNING! This will remove all networks not used by at least one container.
Are you sure you want to continue? [y/N]
Type y and docker will remove all of the networks that you are not using.
The quickest way to clean up docker will clean up all of your unused containers, volumes, images and networks at once. You can clean up your entire host system by typing out the following command in your terminal:
docker system prune
root@docker-ubuntu-s-1vcpu-2gb-nyc1-01:~/ap/prune-docker# docker system prune
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all dangling build cache
Are you sure you want to continue? [y/N] y
Deleted Networks:
ping-docker-compose_default
redis-finance-prophet_default
Total reclaimed space: 0B
When you hit enter, you’ll be presented with the following warning:
WARNING! This will remove:
Are you sure you want to continue? [y/N] Typing y and hitting enter will remove every unused item in your docker host.
root@docker-ubuntu-s-1vcpu-2gb-nyc1-01:/dev# docker system df
# BEFORE docker prune
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 19 11 11.26GB 7.329GB (65%)
Containers 19 3 9.892GB 9.892GB (99%)
Local Volumes 9 9 1.9GB 0B (0%)
Build Cache 0 0 0B 0B
# AFTER docker prune
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 18 3 11.26GB 10.53GB (93%)
Containers 3 3 4B 0B (0%)
Local Volumes 1 1 226.5MB 0B (0%)
Build Cache 0 0 0B 0B
# BEFORE docker prune
Images space usage:
REPOSITORY TAG IMAGE ID CREATED SIZE SHARED SIZE UNIQUE SIZE CONTAINERS
<none> <none> 1762654b3180 13 hours ago 453.2MB 452.9MB 286.9kB 2
my_image latest 34c1cd80b6e2 25 hours ago 104.4MB 72.78MB 31.62MB 2
digitalocean.com/php latest 9ddf33f78939 47 hours ago 739.2MB 398.1MB 341.2MB 1
ghcr.io/redisgrafana/redis-app latest ff95faa24fa4 6 days ago 462.9MB 72.78MB 390.1MB 1
ghcr.io/redisgrafana/redis-prophet latest fd771a7dde79 6 days ago 2.378GB 0B 2.378GB 2
php 7.3-fpm 4c013e5980cf 7 days ago 452.9MB 452.9MB 0B 0
php 7.4-fpm 2cd6c3eedab2 7 days ago 459.6MB 349.4MB 110.2MB 0
influxdb 2.0.8 d0eb1991d5e6 12 days ago 344.6MB 150.9MB 193.8MB 0
composer latest aa855c271386 2 weeks ago 175.6MB 5.595MB 170MB 0
nginx alpine 7ce0143dee37 2 weeks ago 22.85MB 5.595MB 17.25MB 1
ubuntu latest 1318b700e415 4 weeks ago 72.78MB 72.78MB 0B 0
influxdb 2.0.7 d636ad7ee210 4 weeks ago 351.3MB 150.9MB 200.4MB 2
redis latest aa4d65e670d6 4 weeks ago 105.4MB 0B 105.4MB 2
wasmedge/wasmedge latest f187da719e71 7 weeks ago 1.794GB 0B 1.794GB 0
secondstate/wasmedge-nodejs-starter latest 6c06772ea943 7 weeks ago 3.981GB 0B 3.981GB 0
hello-world latest d1165f221234 5 months ago 13.34kB 0B 13.34kB 1
php 7.2-fpm 28f52b60203d 8 months ago 398.1MB 398.1MB 0B 0
redis 5.0.3 0f88f9be5839 2 years ago 94.98MB 0B 94.98MB 1
mysql 5.7.22 6bb891430fb6 3 years ago 371.9MB 0B 371.9MB 1
Containers space usage:
CONTAINER ID IMAGE COMMAND LOCAL VOLUMES SIZE CREATED STATUS NAMES
00fdc1d4489e 1762654b3180 "/bin/sh -c 'apt-get…" 0 17.6MB 13 hours ago Exited (100) 13 hours ago eloquent_dirac
95f3a5b1f0c7 1762654b3180 "/bin/sh -c 'apt-get…" 0 17.6MB 13 hours ago Exited (100) 13 hours ago relaxed_stonebraker
b51f732a1a67 0da505c998bd "/bin/sh -c 'docker-…" 0 135MB 13 hours ago Exited (1) 13 hours ago busy_jepsen
a0713609394f 0da505c998bd "/bin/sh -c 'docker-…" 0 135MB 13 hours ago Exited (1) 13 hours ago hopeful_raman
df4bb614c63a f36763b5ac7c "/bin/sh -c 'docker-…" 0 118MB 13 hours ago Exited (1) 13 hours ago vibrant_gagarin
0b7ae0932a11 my_image "ping service-1 -c 3" 0 0B 25 hours ago Exited (0) 25 hours ago service-2
ca2a0ec78102 my_image "ping service-2 -c 3" 0 0B 25 hours ago Exited (0) 25 hours ago service-1
2c88abbac5a7 digitalocean.com/php "docker-php-entrypoi…" 0 0B 47 hours ago Up 13 hours app
28474849408f mysql:5.7.22 "docker-entrypoint.s…" 1 2B 47 hours ago Up 47 hours db
841a60bf76c4 nginx:alpine "/docker-entrypoint.…" 0 2B 47 hours ago Up 14 hours webserver
3957f5e05661 ghcr.io/redisgrafana/redis-prophet:latest "redis-server --load…" 1 9.13GB 6 days ago Exited (0) 14 hours ago redis
04386c1b7cf3 ghcr.io/redisgrafana/redis-prophet:latest "redis-server --load…" 1 339MB 6 days ago Exited (0) 6 days ago redis-prophet
64639d5daaa1 ghcr.io/redisgrafana/redis-app:latest "/run.sh" 0 690kB 6 days ago Exited (0) 14 hours ago grafana
f3e78730699e redis "docker-entrypoint.s…" 1 0B 8 days ago Exited (0) 8 days ago some-redis2
456c111a7a9d redis "docker-entrypoint.s…" 1 0B 8 days ago Exited (0) 8 days ago some-redis
581c99ab953b redis:5.0.3 "docker-entrypoint.s…" 1 0B 9 days ago Exited (137) 8 days ago redis5-under-the-hood
b1744742d827 influxdb:2.0.7 "/entrypoint.sh infl…" 2 0B 2 weeks ago Exited (0) 2 weeks ago eager_moser
14a42001263b influxdb:2.0.7 "/entrypoint.sh infl…" 1 0B 2 weeks ago Exited (0) 2 weeks ago influxdb
6abf3f155407 hello-world "/hello" 0 0B 8 weeks ago Exited (0) 8 weeks ago stoic_moore
Local Volumes space usage:
VOLUME NAME LINKS SIZE
0cbe045a760936bc325c9ea860e5c8abb79128198af2dc3dd05f8c9335e82f16 1 1.338GB
6d5820d3ae24dd40fdad0568800a269315f172558644ef5f1d343b71527e25a6 1 663B
f2624b757bbd98429a47178b3b8fd172bb6aa36238261eaaff061ff4ad12c1e5 1 65.54kB
5ce7099f06d04fdfc5bb52b8593e1443f4fb3b890e6028af7f884ea6958e9f5c 1 92B
laravel-app_dbdata 1 226.5MB
b86217fb64e141d1f230ef02c16d3e21a60668329e43738d16c65b44c0330dab 1 334.6MB
24187a11d7197fd8889d0d5f973bc27a7978866666d02635c098043bdd14b69d 1 92B
70f4a7322ac5c843fc72ec112319b7eebee085cdc0f216d8c8c14f3fc6300197 1 0B
c77d9eb21bc4cef0fffe1b830828388e2c052f0385007ae1b37de46a8a9ee420 1 0B
Build cache usage: 0B
CACHE ID CACHE TYPE SIZE CREATED LAST USED USAGE SHARED
# AFTER docker prune
Images space usage:
REPOSITORY TAG IMAGE ID CREATED SIZE SHARED SIZE UNIQUE SIZE CONTAINERS
my_image latest 34c1cd80b6e2 26 hours ago 104.4MB 72.78MB 31.62MB 0
digitalocean.com/php latest 9ddf33f78939 2 days ago 739.2MB 398.1MB 341.2MB 1
ghcr.io/redisgrafana/redis-app latest ff95faa24fa4 6 days ago 462.9MB 72.78MB 390.1MB 0
ghcr.io/redisgrafana/redis-prophet latest fd771a7dde79 6 days ago 2.378GB 0B 2.378GB 0
php 7.3-fpm 4c013e5980cf 7 days ago 452.9MB 349.4MB 103.5MB 0
php 7.4-fpm 2cd6c3eedab2 7 days ago 459.6MB 349.4MB 110.2MB 0
influxdb 2.0.8 d0eb1991d5e6 12 days ago 344.6MB 150.9MB 193.8MB 0
composer latest aa855c271386 2 weeks ago 175.6MB 5.595MB 170MB 0
nginx alpine 7ce0143dee37 2 weeks ago 22.85MB 5.595MB 17.25MB 1
ubuntu latest 1318b700e415 4 weeks ago 72.78MB 72.78MB 0B 0
influxdb 2.0.7 d636ad7ee210 4 weeks ago 351.3MB 150.9MB 200.4MB 0
redis latest aa4d65e670d6 4 weeks ago 105.4MB 0B 105.4MB 0
wasmedge/wasmedge latest f187da719e71 7 weeks ago 1.794GB 0B 1.794GB 0
secondstate/wasmedge-nodejs-starter latest 6c06772ea943 7 weeks ago 3.981GB 0B 3.981GB 0
hello-world latest d1165f221234 5 months ago 13.34kB 0B 13.34kB 0
php 7.2-fpm 28f52b60203d 8 months ago 398.1MB 398.1MB 0B 0
redis 5.0.3 0f88f9be5839 2 years ago 94.98MB 0B 94.98MB 0
mysql 5.7.22 6bb891430fb6 3 years ago 371.9MB 0B 371.9MB 1
Containers space usage:
CONTAINER ID IMAGE COMMAND LOCAL VOLUMES SIZE CREATED STATUS NAMES
2c88abbac5a7 digitalocean.com/php "docker-php-entrypoi…" 0 0B 2 days ago Up 14 hours app
28474849408f mysql:5.7.22 "docker-entrypoint.s…" 1 2B 2 days ago Up 2 days db
841a60bf76c4 nginx:alpine "/docker-entrypoint.…" 0 2B 2 days ago Up 14 hours webserver
Local Volumes space usage:
VOLUME NAME LINKS SIZE
laravel-app_dbdata 1 226.5MB
Build cache usage: 0B
CACHE ID CACHE TYPE SIZE CREATED LAST USED USAGE SHARED
root@docker-ubuntu-s-1vcpu-2gb-nyc1-01:~/ap/prune-docker# df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.9G 0 1.9G 0% /dev
tmpfs 394M 1.3M 393M 1% /run
/dev/vda1 49G 33G 17G 67% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/loop0 56M 56M 0 100% /snap/core18/2074
/dev/vda15 105M 6.6M 98M 7% /boot/efi
/dev/loop2 68M 68M 0 100% /snap/lxd/20326
/dev/loop3 33M 33M 0 100% /snap/snapd/12704
/dev/loop4 71M 71M 0 100% /snap/lxd/21029
/dev/loop5 56M 56M 0 100% /snap/core18/2128
/dev/loop6 33M 33M 0 100% /snap/snapd/12883
overlay 49G 33G 17G 67% /var/lib/docker/overlay2/4543d550275346bc292866694e0ff3d7b6df374cf46ac25fb830cc2d8275e917/merged
overlay 49G 33G 17G 67% /var/lib/docker/overlay2/17b81624b0b4ecb2b3164e93db72b71159d9ad6d861ade50f8a4202ecaacebc6/merged
overlay 49G 33G 17G 67% /var/lib/docker/overlay2/0350a9529302888faca59acf38ef88c05bb5bb20bde2b619b01e679a7e2d85a8/merged
tmpfs 394M 0 394M 0% /run/user/0
root@docker-ubuntu-s-1vcpu-2gb-nyc1-01:~/ap/prune-docker# docker system prune
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all dangling build cache
Are you sure you want to continue? [y/N] y
Total reclaimed space: 0B
root@docker-ubuntu-s-1vcpu-2gb-nyc1-01:~/ap/prune-docker# df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.9G 0 1.9G 0% /dev
tmpfs 394M 1.1M 393M 1% /run
/dev/vda1 49G 33G 17G 67% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/loop0 56M 56M 0 100% /snap/core18/2074
/dev/vda15 105M 6.6M 98M 7% /boot/efi
/dev/loop2 68M 68M 0 100% /snap/lxd/20326
/dev/loop3 33M 33M 0 100% /snap/snapd/12704
/dev/loop4 71M 71M 0 100% /snap/lxd/21029
/dev/loop5 56M 56M 0 100% /snap/core18/2128
/dev/loop6 33M 33M 0 100% /snap/snapd/12883
tmpfs 394M 0 394M 0% /run/user/0
Free up disk space by removing dangling docker images and volumes
https://dev.to/hossein761/free-up-disk-space-by-running-these-docker-commands-2okm
By Hossein Kazemi Feb 13 ・1 min read
If you are using Docker, every now and then your disk gets filled up with dangling docker images and volumes. Simple run the following commands to get rid of them and open up disk space on your machine:
remove dangling images
remove dangling volumes
I am starting a newsletter focused on teaching hands-one backend and infrastructure through building micro-projects.
Follow me on Twitter for the announcement: hossein761 https://twitter.com/hossein761