Documentation
PLEASE NOTE: This document applies to latest version and not to the latest stable release v2.21
Documentation for other releases can be found by using the version selector in the top right of any doc page.docker_prune
Prune unused Docker resources (containers, images, volumes, networks, build cache).
Attributes
check_mode:
support: full
Parameters
| Parameter | Required | Type | Values | Description |
|---|---|---|---|---|
| containers | boolean | Prune stopped containers. | ||
| images | boolean | Prune unused images. | ||
| volumes | boolean | Prune unused volumes. | ||
| networks | boolean | Prune unused networks. | ||
| builder_cache | boolean | Prune build cache. | ||
| all | boolean | Prune all types. | ||
| force | boolean | Do not prompt for confirmation. |
Example
- name: Clean up Docker
docker_prune:
containers: true
images: true
volumes: true
force: true
- name: Prune all Docker resources
docker_prune:
all: true
- name: Clean stopped containers only
docker_prune:
containers: true
- name: Clean build cache
docker_prune:
builder_cache: true