运行Docker Toolbox时添加-f参数 [英] Add -f parameter when running Docker Toolbox
问题描述
我想使用Docker Compose运行Docker容器. docker-compose up
命令工作正常,但我想指定docker-compose.yml
文件的位置.
I would like to run a docker container using Docker Compose. The docker-compose up
command works fine but I want to specify the location of the docker-compose.yml
file.
这是正在运行的命令.在这种情况下,docker-compose.yml
文件的位置为C:\Users\USERNAME\docker-compose.yml
This is the command that is working. In this case the location of the docker-compose.yml
file is C:\Users\USERNAME\docker-compose.yml
"C:\Program Files\Git\bin\bash.exe" --login -i "C:\Program Files\Docker Toolbox\start.sh" docker-compose up
现在,当我添加-f
参数时,Docker Toolbox就会崩溃.假设我要将文件放在C:\docker-compose.yml
Now when I add the -f
parameter, the Docker Toolbox just crashes. Say I want to put the file under C:\docker-compose.yml
"C:\Program Files\Git\bin\bash.exe" --login -i "C:\Program Files\Docker Toolbox\start.sh" docker-compose -f "C:\docker-compose.yml" up
之所以需要这样做,是因为我将使用C#代码对接Neo4j图像,并且试图使此字符串正常工作.
Why I need this is because I would dock a Neo4j image using C# code and I am trying to make this string work.
推荐答案
您正在使用BASH,因此您需要使用Linux样式的路径-c:\app
变为/c/app
.试试:
You're using BASH so you need to use Linux-style paths - c:\app
becomes /c/app
. Try:
...docker-compose -f /c/docker-compose.yml
Docker工具箱中的启动脚本 BASH的参数,它不会从Windows进行任何语法转换.
The start script in Docker Toolbox just passes through your arguments to BASH, it doesn't do any syntax conversion from Windows.
这篇关于运行Docker Toolbox时添加-f参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!