Article
home/blog/Loading

Clear up unused space in docker

Every time you run docker compile on a Dockerfile a container is created, taking up space on your computer.

This can quickly take up a lot of space.

The Solution

The solution is to delete those containers that you probably dont care about anymore. After all, you can just create a new latest version of the container directly from your dockerfile.

docker system prune

The terminal will then query you if you wish to cleanup, you should press y to this.

WARNING! This will remove:
    - all stopped containers
    - all networks not used by at least one container
    - all dangling images
    - all build cache
Are you sure you want to continue? [y/N] 

Success. The terminal will output the results of the command. In this instance it saved 44.7gb for me.

deleted: sha256:20656a8ff14b6d5d75ed5211ae03fbd64153ce3f116b2b64cc83d9422190d379
deleted: sha256:16b5a04b3cfc92a4b014c75e3243b1eff2b82a31dc9e221b9991a7e9ac09bcb9
deleted: sha256:768fac5c4aa060c2119f1afd0bd428a96bfc0061e48c20dc04cefd070e6a72f2

Total reclaimed space: 44.73GB