Maintenance
Free disk space by removing unused containers, images, networks, volumes and build cache.
Docker keeps old images, stopped containers and build cache until you remove them. Docker Manager cleans them up once, or on a schedule.
A removal can't be undone, and removing a volume deletes its data. Check the preview before you confirm.
Clean up once
The Containers, Images, Volumes, Networks and Builds pages each have a prune button: Prune Containers, Prune Images, Prune Volumes, Prune Networks and Prune Build Cache.
- Press it and choose what to remove.
- Press Preview to see exactly what goes and about how much space you get back.
- Press Prune N Objects to confirm.
Clean up on a schedule
Maintenance cleans up every server on one schedule, with one set of rules.
- Open Maintenance and press Edit.
- Under Environments, uncheck an environment to leave it out. Environments you add later are covered too.
- Turn on Run Automatically and pick the schedule.
- Every rule starts off; turn on the ones you want: Stopped Containers, Dangling Images, All Unused Images, Unused Networks, Build Cache, Anonymous Volumes and Named Volumes. Removing volumes deletes their data, so you must confirm it.
- Under a rule's Options, set Only Remove Objects Older Than (in days or hours), or list objects to Never Remove.
- Press Save Changes.
Preview shows what a run would remove on each server right now. Run Now runs it after you confirm with Run Maintenance.
While a cleanup runs, one line shows the object it is removing. When it ends you see how many objects it handled and the first ones that failed; the job's page lists every object.
Space Reclaimed adds up what the last run freed on every server: for images and build cache the space Docker freed by each removal, for containers and volumes the size Docker reported for them just before the run removed them. The preview's sizes are only an estimate: images that share layers count those layers once per image there.
- "At least" means Docker didn't report how much some removed objects freed.
- "About" means a server's Docker Agent reported the preview's sizes instead; upgrade it to get measured figures.
Build cache
Build Cache cleans every builder on the server: Docker's own and the
extra builders that CI pipelines and docker buildx create keep. The
preview shows each entry's builder.
- A builder that no build used for longer than the rule's age is removed with its cache. It is created again the next time a build needs it.
- Prune Build Cache starts with an age of 0, All Unused Records, Not Only Dangling on and no cache to keep: it removes every builder that isn't running a build.
- A stopped builder is started for the run, cleaned and stopped again. It keeps running if a build starts using it meanwhile.
- Only Build Cache removes builders; Stopped Containers and Named Volumes leave them alone.
- To keep a builder, add its name to Never Remove.
- Keep the Most Recent Cache Up to (GB) is in decimal gigabytes (1 GB = 1,000,000,000 bytes).
What is always kept
- Docker Manager's own containers, images, volumes and networks.
- Stacks Docker Manager manages, with their images, volumes and networks.
- Containers Docker Manager created, with their images.
- Volumes that backups cover, while backups are on: Anonymous Volumes and Named Volumes remove only volumes the backup settings leave out. Volumes Docker names with 64 hexadecimal characters count as anonymous.
- Anything with the label
docker-manager.maintenance.exclude=true.
Every object is checked again right before it is removed, so something that came into use after the preview is kept.