简体   繁体   English

“docker-compose.yml”的路径作为参数

[英]path to “docker-compose.yml” as a parameter

Today in order to launch my docker containers specified/included in my docker-compose.yml file, I first go to the folder where the docker-compose.yml is located and then I type: Today in order to launch my docker containers specified/included in my docker-compose.yml file, I first go to the folder where the docker-compose.yml is located and then I type:

docker-compose up -d

and it works very well!而且效果很好!

WHAT IF I wish to run that "docker-compose up" command from a different folder (not from inside the folder where docker-compose.yml is located):如果我希望从不同的文件夹(而不是从 docker-compose.yml 所在的文件夹内部)运行“docker-compose up”命令,该怎么办:

I tried:我试过了:

docker-compose up -d -f /data/....../docker-compose.yml

but that did not work as I received a warning that did redisplay all the possible options and "-f" was not 1 of of the option listed.但这不起作用,因为我收到了一个警告,该警告确实重新显示了所有可能的选项,并且“-f”不是列出的选项之一。

So how do I specify a path to "docker-compose.yml" as a CLI parameter to my "docker-compose up" command?那么如何将“docker-compose.yml”的路径指定为我的“docker-compose up”命令的 CLI 参数?

docker-compose is pretty picky about which parts of the command take options. docker-compose 对于命令的哪些部分采用选项非常挑剔。 In this case, docker-compose up doesn't take a -f option.在这种情况下, docker-compose up不采用-f选项。

However, docker-compose itself does take a -f option.但是, docker-compose本身确实采用了-f选项。 Try running:尝试运行:

docker-compose -f /data/......./docker-compose.yml up -d

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM