Merge pull request #592 from tonistiigi/run-entrypoint

dockerfile: never use entrypoint for run commands
docker-18.09
Akihiro Suda 2018-08-28 06:52:23 -07:00 committed by GitHub
commit 94cc96a0ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 2 deletions

View File

@ -572,8 +572,6 @@ func dispatchRun(d *dispatchState, c *instructions.RunCommand, proxy *llb.ProxyE
var args []string = c.CmdLine
if c.PrependShell {
args = withShell(d.image, args)
} else if d.image.Config.Entrypoint != nil {
args = append(d.image.Config.Entrypoint, args...)
}
opt := []llb.RunOption{llb.Args(args)}
for _, arg := range d.buildArgs {

View File

@ -75,9 +75,39 @@ func TestIntegration(t *testing.T) {
testPlatformArgsExplicit,
testExportMultiPlatform,
testQuotedMetaArgs,
testIgnoreEntrypoint,
})
}
func testIgnoreEntrypoint(t *testing.T, sb integration.Sandbox) {
t.Parallel()
dockerfile := []byte(`
FROM busybox
ENTRYPOINT ["/nosuchcmd"]
RUN ["ls"]
`)
dir, err := tmpdir(
fstest.CreateFile("Dockerfile", dockerfile, 0600),
)
require.NoError(t, err)
defer os.RemoveAll(dir)
c, err := client.New(context.TODO(), sb.Address())
require.NoError(t, err)
defer c.Close()
_, err = c.Solve(context.TODO(), nil, client.SolveOpt{
Frontend: "dockerfile.v0",
LocalDirs: map[string]string{
builder.LocalNameDockerfile: dir,
builder.LocalNameContext: dir,
},
}, nil)
require.NoError(t, err)
}
func testQuotedMetaArgs(t *testing.T, sb integration.Sandbox) {
t.Parallel()