首页 > 解决方案 > docker compose 命令 down 和 up 不会创建新的图像和容器

问题描述

我有 .net、sql 数据库、kafka docker 图像,我使用 docker compose yml 文件将它们一起运行。

我注意到命令 down 和 up 不会创造新的环境。

docker compose docker-compose -f dc-all-sql.yml down

然后:

docker-compose -f dc-all-sql.yml up

我只使用 docker desktop 'rest factory setting' 选项设法拥有新鲜的环境。

我对这些命令的理解是错误的吗?

基本上我想要一个新鲜的环境,当我启动系统时,下载了新的 docker 图像。

标签: dockerdocker-composedockerfile

解决方案


默认情况下,唯一删除的内容down是:

Containers for services defined in the Compose file
Networks defined in the networks section of the Compose file
The default network, if one is used

所以图像不会被删除,你可以使用它down

选项:

--rmi type              Remove images. Type must be one of:
                          'all': Remove all images used by any service.
                          'local': Remove only images that don't have a
                          custom tag set by the `image` field.

看到这个


推荐阅读