ScanSkill

docker compose rm

docker compose rm removes stopped containers associated with the service.

By default, volumes attached to containers will not be removed. You can override this with -v. To list all volumes, use docker volume ls.

Note: Any data which is not in a volume will be lost.

Syntax

$ docker compose rm [options] [SERVICE...]

Here,

Options:

  • -f, --force → Don't ask to confirm the removal
  • -v, --volumes → Remove any anonymous volumes attached to containers
  • -a, --all → Also remove one-off containers created by docker-compose run
  • -s, --stop → Stop the containers, if required, before removing

Example

$ docker compose rm

Going to remove djangoquickstart_web_run_1
Are you sure? [yN] y
Removing djangoquickstart_web_run_1 ... done