docker-compose -f docker-compose down
时间: 2023-10-31 12:05:16 浏览: 101
docker-compose -f docker-compose.yml down 命令用于停止并删除由docker-compose启动的所有容器、网络和卷。该命令会停止并删除所有服务容器,但不会删除镜像、网络和卷。如果您想要删除这些资源,请使用docker-compose down --volumes选项。
相关问题
docker-compose down
The `docker-compose down` command is used to stop and remove containers, networks, and volumes that were created by `docker-compose up`. This command will remove all the resources that were created by `docker-compose up` command in the reverse order in which they were created.
Note that this command does not remove images or other resources that were not created by `docker-compose up` command. To remove those resources, you can use the appropriate `docker` commands.
Usage:
```
docker-compose down [options]
```
Options:
- `-v, --volumes`: Remove named volumes declared in the `volumes` section of the `docker-compose.yml` file.
- `--rmi <all|local>`: Remove images. `all` removes all images used by any service. `local` removes only images that don't have a custom tag set by the `image` field in the `docker-compose.yml` file.
- `--remove-orphans`: Remove containers for services not defined in the `docker-compose.yml` file.
- `-t, --timeout <seconds>`: Specify a shutdown timeout in seconds (default: 10).
Example:
```
$ docker-compose down --volumes --remove-orphans
```
docker -compose down
`docker-compose down`命令用于停止并删除由`docker-compose up`命令启动的容器、网络和卷。该命令应该在包含`docker-compose.yml`文件的目录中运行。以下是一个使用`docker-compose down`命令的例子:
```bash
cd /path/to/docker-compose/directory
docker-compose down
```
该命令将停止并删除所有相关容器、网络和卷。如果您只想停止容器而不删除它们,可以使用`docker-compose stop`命令。如果您只想删除容器而不停止它们,可以使用`docker-compose rm`命令。
相关推荐
![none](https://img-home.csdnimg.cn/images/20210720083646.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)