首页 > 解决方案 > 如何使用自定义文件名运行 docker-compose

问题描述

我有这个文件:docker-compose.test.yml

但是当我尝试运行时docker-compose,会发生这种情况:

$ docker-compose up
ERROR:
        Can't find a suitable configuration file in this directory or any
        parent. Are you in the right directory?

        Supported filenames: docker-compose.yml, docker-compose.yaml

是否有一些选项可以指定要使用的文件?

标签: dockerdocker-compose

解决方案


使用-f选项指定文件名。

例子:

docker-compose -f docker-compose.test.yml up

推荐阅读