diff --git a/frontend/dockerfile/dockerfile2llb/convert.go b/frontend/dockerfile/dockerfile2llb/convert.go index ab78d258..e947564a 100644 --- a/frontend/dockerfile/dockerfile2llb/convert.go +++ b/frontend/dockerfile/dockerfile2llb/convert.go @@ -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 { diff --git a/frontend/dockerfile/dockerfile_test.go b/frontend/dockerfile/dockerfile_test.go index 66cc8dcf..cc7e13f2 100644 --- a/frontend/dockerfile/dockerfile_test.go +++ b/frontend/dockerfile/dockerfile_test.go @@ -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()