$ shellfirm
Protection Coverage

Docker

Protection patterns for Docker container, image, volume, and network operations

The docker check group covers destructive Docker operations that can remove containers, images, volumes, and networks.

Docker checks

System prune (all)

IDdocker:system_prune_all
SeverityHigh
Alternativedocker system prune -- without -a, only dangling images are removed
Blast radiusCounts images, containers, and volumes on the system
# Triggers
docker system prune -a
docker system prune --all

Force remove all containers

IDdocker:force_remove_all_containers
SeverityHigh
Blast radiusCounts running containers
# Triggers
docker rm -f $(docker ps -aq)
docker rm --force $(docker ps -aq)

Force remove images

IDdocker:force_remove_images
SeverityHigh
# Triggers
docker rmi -f my-image:latest
docker rmi --force $(docker images -q)

Remove volume

IDdocker:remove_volume
SeverityHigh
# Triggers
docker volume rm my-data-volume
docker volume rm postgres_data redis_data

Volume prune

IDdocker:volume_prune
SeverityHigh
Blast radiusCounts unused volumes
# Triggers
docker volume prune

Remove network

IDdocker:remove_network
SeverityMedium
# Triggers
docker network rm my-network

Compose down with volumes

IDdocker:compose_down_volumes
SeverityHigh
Alternativedocker-compose down -- without -v, volumes are preserved
# Triggers
docker-compose down -v
docker-compose down --volumes
docker compose down -v

Stop all containers

IDdocker:stop_all_containers
SeverityMedium
Blast radiusCounts running containers
# Triggers
docker stop $(docker ps -q)

Blast radius support

Docker checks with blast radius compute real-time counts from your Docker daemon:

  • System prune queries docker images -q, docker ps -aq, and docker volume ls -q to count what would be removed
  • Force remove containers queries docker ps -q for running container count
  • Volume prune queries docker volume ls -q for unused volume count
  • Stop all queries docker ps -q for running container count

Example output:

============ RISKY COMMAND DETECTED ============
Severity: HIGH
Description: This will remove all unused Docker data including stopped containers,
  networks, dangling images, and build cache.
Blast radius: Prunes up to 15 images, 4 containers, 3 volumes
Alternative: docker system prune
  (Without -a, only dangling images are removed instead of all unused images.)

? Solve the challenge:: 9 + 3 = ? Esc to cancel ›

All blast radius queries run with a 3-second timeout and degrade gracefully if Docker is not running or the query times out.