mirror of
https://github.com/clearlinux/docker.git
synced 2026-10-03 15:28:35 +00:00
builder: Restore /bin/sh handling in CMD when entrypoint is specified with JSON
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
This commit is contained in:
@@ -16,6 +16,40 @@ import (
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
)
|
||||
|
||||
func TestBuildShCmdJSONEntrypoint(t *testing.T) {
|
||||
name := "testbuildshcmdjsonentrypoint"
|
||||
defer deleteImages(name)
|
||||
|
||||
_, err := buildImage(
|
||||
name,
|
||||
`
|
||||
FROM busybox
|
||||
ENTRYPOINT ["/bin/echo"]
|
||||
CMD echo test
|
||||
`,
|
||||
true)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
out, _, err := runCommandWithOutput(
|
||||
exec.Command(
|
||||
dockerBinary,
|
||||
"run",
|
||||
name))
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if strings.TrimSpace(out) != "/bin/sh -c echo test" {
|
||||
t.Fatal("CMD did not contain /bin/sh -c")
|
||||
}
|
||||
|
||||
logDone("build - CMD should always contain /bin/sh -c when specified without JSON")
|
||||
}
|
||||
|
||||
func TestBuildEnvironmentReplacementUser(t *testing.T) {
|
||||
name := "testbuildenvironmentreplacement"
|
||||
defer deleteImages(name)
|
||||
|
||||
Reference in New Issue
Block a user