Cleaning Resources

Learn how to clean your resources of stopped containers and dangling images in Docker.

Reasons for cleaning in Docker

One of the valuable and significant reasons we’ll enjoy Docker is when the environment we provisioned for it has lots of space. However, sometimes even with enough space made available, we still experience space issues. To curb this issue, we realize there’s a need to clean up our Docker environment often. Most times, what occupies the provisioned space isn’t our application running but other items not useful in the environment. Once the Docker environment gets filled up, applications won’t work any longer.

Resources that occupy space

Here are the items that might be occupying space in an environment:

  • Exited containers: These are containers no longer running or useful in our environment. They have exited while performing what they were provisioned for but are still lying fallow in the Docker environment.

  • Exited images: These are images that were in a container in the Docker environment but exited because the container wasn’t running anymore. These images are still found within the Docker environment, taking up space. Docker images that aren’t in running containers are called dangling images.

  • ...