多克多线 CMD 或 ENTRYPOINT

由于许多参数,对于默认进程,我有一个非常长的命令行。我认为最简单的方法是创建一个脚本(针对 eg.run.sh) ,然后在 ENTRYPOINTCMD中调用这个脚本。我想知道是否有一种方法,使您的 ENTRYPOINTCMD多行(我们编写 RUN的方式)。为了..。

ENTRYPOINT["/path/myprocess",
"arg1",
"arg2" ]

我认为这是一个有效的语法,因为格式是 json

Step 14 : ENTRYPOINT[
Unknown instruction: ENTRYPOINT[

有没有办法把 ENTRYPOINT分成多条线?

41589 次浏览

It was a typo in the dockerfile. I missed a space between ENTRYPOINT and [. Dockerfile supports multiline ENTRYPOINT and CMD by terminating the line with \, same as RUN. So, in my case it can be

ENTRYPOINT [ "/path/myprocess", \
"arg1",            \
"arg2"             \
]