Skip to content

Windows: Dockerfile RUN in JSON format fails to escape parameters #22874

@jstarks

Description

@jstarks

Latest Docker master, targeting Windows:

Dockerfile:

FROM nanoserver

RUN ["cmd /c echo this should fail"]

Expected output:

Sending build context to Docker daemon 2.048 kB
Step 1 : FROM nanoserver
 ---> b347fce3157a
Step 2 : RUN cmd /c echo this should fail
 ---> Running in bca3f37416f3
Container command 'cmd /c echo this should fail' not found or does not exist

Actual output:

Sending build context to Docker daemon 2.048 kB
Step 1 : FROM nanoserver
 ---> b347fce3157a
Step 2 : RUN cmd /c echo this should fail
 ---> Running in bca3f37416f3
this should fail
 ---> 9cc6bd333e69
Removing intermediate container bca3f37416f3
Successfully built 9cc6bd333e69

I believe the fix is to set ArgsEscaped to false when parsing a JSON-formatted RUN command.

The same bug probably applies to CMD once #22868 is merged.

cc @jhowardmsft @darrenstahlmsft

Metadata

Metadata

Assignees

Labels

area/builderBuildkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.platform/windows

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions