Docker 17
撰写 | Compose

docker-compose rm

docker-compose rm

Usage: rm [options] [SERVICE...] Options: -f, --force Don't ask to confirm removal -s, --stop Stop the containers, if required, before removing -v Remove any anonymous volumes attached to containers

删除已停止的服务容器。

默认情况下,附加到容器的匿名卷不会被删除。你可以用这个覆盖它-v。要列出所有卷,请使用docker volume ls

任何不在卷中的数据都将丢失。

运行没有选项的命令也会删除由docker-compose up或创建的一次性容器docker-compose run

$ docker-compose rm Going to remove djangoquickstart_web_run_1 Are you sure? [yN] y Removing djangoquickstart_web_run_1 ... done

fig, composition, compose, docker, orchestration, cli, rm