小编dra*_*oth的帖子

转义双引号会导致 3 个而不是 4 个参数

strace 表明,与 shell 形式相比,我使用的转义可能会导致问题(shell 形式与 exec 形式请参阅https://docs.docker.com/engine/reference/builder/)

带有 [/* 3 vars */] 的 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
Run Code Online (Sandbox Code Playgroud)

带有 [/* 4 vars */] 的 shell 形式 - 工作正常

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"
Run Code Online (Sandbox Code Playgroud)

Dockerfile:(使用 ubuntu,因为我无法使用 alpine:latest 运行 strace。)

# escape=\
# first …
Run Code Online (Sandbox Code Playgroud)

escaping docker dockerfile

5
推荐指数
0
解决办法
1586
查看次数

标签 统计

docker ×1

dockerfile ×1

escaping ×1