# docker rm: Remove Containers & Force Cleanup

> How docker rm works: removing stopped containers, force-removing running ones, removing volumes, and CI cleanup patterns.

Source: https://latchkey.dev/learn/command-reference/docker-rm-command  
Updated: 2026-06-25

Delete containers - stopped by default, running ones with -f.

docker rm (alias docker container rm) removes containers. This page covers force removal, removing anonymous volumes, and bulk cleanup in CI.

## What it does

docker rm deletes one or more stopped containers and their writable layer. With -f it stops (SIGKILL) and removes a running container in one step.

## Common usage

```Terminal
docker rm web
docker rm -f web                       # force-remove a running container
docker rm -v web                       # also remove anonymous volumes
docker rm $(docker ps -aq)             # remove all containers
```

## Common errors in CI

"You cannot remove a running container ... Stop the container before attempting removal or force remove" - add -f, or stop it first. "docker rm requires at least 1 argument" happens when docker ps -aq is empty; guard the cleanup step. Prefer running disposable containers with --rm so CI does not accumulate stopped containers at all.

## FAQ

### docker rm: Remove Containers & Force Cleanup?

docker rm (alias docker container rm) removes containers. This page covers force removal, removing anonymous volumes, and bulk cleanup in CI.

### What it does?

docker rm deletes one or more stopped containers and their writable layer. With -f it stops (SIGKILL) and removes a running container in one step.

### Common errors in CI?

"You cannot remove a running container ... Stop the container before attempting removal or force remove" - add -f, or stop it first. "docker rm requires at least 1 argument" happens when docker ps -aq is empty; guard the cleanup step. Prefer running disposable containers with --rm so CI does not accumulate stopped containers at all.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
