Docker运行:多行

时间:2018-09-21 09:30:44

标签: windows docker command-line

在Windows命令提示符中是否有一种运行方式,即通过多行显示的“ docker run”命令,例如代替

"docker run -v .. --name .. --entrypoint .. <image_name>"

类似

"docker run 
-v. ..
--name ..
--entrypoint ..
<image_name>"

编辑变得越来越痛苦!谢谢,乔尼

edit:我尝试添加^命令,它不起作用。 "docker run" requires at least 1 argument.

只是错误

2 个答案:

答案 0 :(得分:2)

我认为最好的工具是docker-compose,它使用docker-compose.yml文件来准备运行或构建指令。

因此,它将是yml或yaml格式的文本文件,并使用不同的关键字作为参考。

https://docs.docker.com/compose/overview/

Compose is a tool for defining and running multi-container Docker applications.  
With Compose, you use a YAML file to configure your application’s services.   
Then, with a single command, you create and start all the services from your configuration.   
To learn more about all the features of Compose, see the list of features.

答案 1 :(得分:0)

万一有人出现在这里,而不是上面可能的重复项,并且被^推迟,对我不起作用: 如果使用dos(即不使用powershell) 替换字符  \ 在Linux的docker命令末尾添加空格和反斜杠  ^ 也就是说,倒数第二行以外的所有行尾的空格和插入符号似乎对我有用。

相关问题