Docker 转义双引号将导致参数3而不是4

Docker 转义双引号将导致参数3而不是4,docker,escaping,dockerfile,Docker,Escaping,Dockerfile,strace透露,与shell表单相比,我使用的转义可能会导致问题(shell表单vs exec表单请参阅) 带有[/*3个变量的exec表单*/]-中断/制造麻烦 ENTRYPOINT ["strace", "hugo", "server", "--watch=true", "--bind=0.0.0.0", "--source=\"/src\"", "--destination=\"/output\""] execve("hugo", ["hugo", "server", "--watch=

strace透露,与shell表单相比,我使用的转义可能会导致问题(shell表单vs exec表单请参阅)

带有[/*3个变量的exec表单*/]-中断/制造麻烦

ENTRYPOINT ["strace", "hugo", "server", "--watch=true", "--bind=0.0.0.0", "--source=\"/src\"", "--destination=\"/output\""]
execve("hugo", ["hugo", "server", "--watch=true", "--bind=0.0.0.0", "--source=\"/src\"", "--destination=\"/output\""], [/* 3 vars */]) = 0
带[/*4个变量的外壳形状*/]-效果良好

ENTRYPOINT strace hugo server --watch=true --bind=0.0.0.0 --source=""/src"" --destination=""/output""
execve("hugo", ["hugo", "server", "--watch=true", "--bind=0.0.0.0", "--source=/src", "--destination=/output"], [/* 4 vars */]) = 0"
Dockerfile: (使用ubuntu,因为我无法使用alpine:latest运行strace。)

运行和保存输出的命令:

 sudo docker run --security-opt seccomp:unconfined docker-hugo &> docker-hugo.strace
(有关--security opt的信息,请参阅)

可能情况概述:

+------------------+-------------------------------------------+------------------------+---------------------------------------------------+
|                  | No Entrypoint                             | Entrypoint (JSON-form) | Entrypoint (shell-form)                           |
+------------------+-------------------------------------------+------------------------+---------------------------------------------------+
| No CMD           | HostConfig.Config.cmd=/bin/bash is called | breaks                 | ok                                                |
|                  | (assumption as of docker inspect)         |                        |                                                   |
+------------------+-------------------------------------------+------------------------+---------------------------------------------------+
| CMD (JSON-form)  | breaks                                    | breaks                 | breaks                                            |
|                  |                                           |                        | (other issue; not handled here                    |
+------------------+-------------------------------------------+------------------------+---------------------------------------------------+
| CMD (shell-form) | ok                                        | ok                     | Breaks [seems to work as designed]                |
|                  |                                           |                        | (both are called with a shell concatinated)       |
|                  |                                           |                        | Example: /bin/sh -c <ENTRYPOINT> /bin/sh -c <CMD> |
+------------------+-------------------------------------------+------------------------+---------------------------------------------------+
+------------------+-------------------------------------------+------------------------+---------------------------------------------------+
||无入口点|入口点(JSON格式)|入口点(shell格式)|
+------------------+-------------------------------------------+------------------------+---------------------------------------------------+
|没有CMD | HostConfig.Config.CMD=/bin/bash被称为| breaks | ok|
||(假设为docker inspect)||
+------------------+-------------------------------------------+------------------------+---------------------------------------------------+
|CMD(JSON格式)| breaks | breaks | breaks|
|| | | |(其他问题;此处不处理)|
+------------------+-------------------------------------------+------------------------+---------------------------------------------------+
|CMD(外壳形式)| ok | ok |中断[似乎按设计工作]|
|| | | |(两者都用壳表示)|
|| | |示例:/bin/sh-c/bin/sh-c|
+------------------+-------------------------------------------+------------------------+---------------------------------------------------+
所以我的问题是:我是否没有正确地转义JSON数组

+------------------+-------------------------------------------+------------------------+---------------------------------------------------+
|                  | No Entrypoint                             | Entrypoint (JSON-form) | Entrypoint (shell-form)                           |
+------------------+-------------------------------------------+------------------------+---------------------------------------------------+
| No CMD           | HostConfig.Config.cmd=/bin/bash is called | breaks                 | ok                                                |
|                  | (assumption as of docker inspect)         |                        |                                                   |
+------------------+-------------------------------------------+------------------------+---------------------------------------------------+
| CMD (JSON-form)  | breaks                                    | breaks                 | breaks                                            |
|                  |                                           |                        | (other issue; not handled here                    |
+------------------+-------------------------------------------+------------------------+---------------------------------------------------+
| CMD (shell-form) | ok                                        | ok                     | Breaks [seems to work as designed]                |
|                  |                                           |                        | (both are called with a shell concatinated)       |
|                  |                                           |                        | Example: /bin/sh -c <ENTRYPOINT> /bin/sh -c <CMD> |
+------------------+-------------------------------------------+------------------------+---------------------------------------------------+