Optimizing Your Docker: A Comprehensive Guide

Reading Time: < 1
Learn how to declutter your Docker, removing all unused data, containers, networks and images to reclaim space.

Table of Contents

Remove unused data including unused containers, networks, images (both dangling and unreferenced), and optionally, volumes.

				
					$ sudo docker system prune -a --volumes


[sudo] password for gary:

WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all images without at least one container associated to them
  - all build cache

Are you sure you want to continue? [y/N] y

Deleted Containers:
416a299e53a68ea079aa7dbaefc26f2c5305ab38e7a0cd40266151443c01919a

Deleted Images:
untagged: nginx:latest
untagged: nginx@sha256:10b8cc432d53a93af434fd40e2ca4
deleted: sha256:ec7862903161761170ecf883b3a206793ef
deleted: sha256:32b128938da8ce4d63a98bed31ad0cd11dc
deleted: sha256:e8a2dea6c4dbd41f833d1fb74fe3e46841a
deleted: sha256:c2394470c6ba004ce651e8048d6d373c385
untagged: ubuntu:16.04
untagged: ubuntu@sha256:3355b4204fac81912a16eb463879

Total reclaimed space: 2.945GB
				
			

Share it on:

Twitter
LinkedIn
Facebook
WhatsApp

About the Author

Gary Gitton
Hello, I'm Gary Gitton - an accomplished Software Engineer, Tech Lead, specializing in PHP, API Engineering, DevOps, and Cloud Management. Throughout my career, I've had the privilege to enhance multiple software solutions with my expertise in multiple languages and platforms. I bring my unique blend of technical and business acumen to every project, ensuring efficient, scalable, and innovative outcomes. I'm also passionate about fostering a culture of continuous learning, mentoring developers, and leading projects with agile methodologies. Whether concocting a bespoke API or orchestrating cloud environments, I'm committed to delivering quality and excellence. Let's connect and transform your vision into a digital reality.

You might also like