diff --git a/cmd/drone-build/client.go b/cmd/drone-build/client.go index f25ac3fa4..bcce7c665 100644 --- a/cmd/drone-build/client.go +++ b/cmd/drone-build/client.go @@ -182,7 +182,7 @@ func daemon(client dockerclient.Client, conf *dockerclient.ContainerConfig, pull id, err = client.CreateContainer(conf, "") // make sure the container is removed in // the event of a creation error. - if len(id) != 0 { + if err != nil && len(id) != 0 { client.RemoveContainer(id, true, true) } if err != nil { diff --git a/cmd/drone-build/util.go b/cmd/drone-build/util.go index 459427959..ec77f3179 100644 --- a/cmd/drone-build/util.go +++ b/cmd/drone-build/util.go @@ -24,6 +24,10 @@ func toContainerConfig(step *common.Step) *dockerclient.ContainerConfig { }, } + if len(config.Entrypoint) == 0 { + config.Entrypoint = nil + } + config.Volumes = map[string]struct{}{} for _, path := range step.Volumes { if strings.Index(path, ":") == -1 { diff --git a/runner/builtin/worker.go b/runner/builtin/worker.go index 66397e9e4..ce3eddb4f 100644 --- a/runner/builtin/worker.go +++ b/runner/builtin/worker.go @@ -170,7 +170,7 @@ func run(client dockerclient.Client, conf *dockerclient.ContainerConfig, name st id, err = client.CreateContainer(conf, name) // make sure the container is removed in // the event of a creation error. - if len(id) != 0 { + if err != nil && len(id) != 0 { client.RemoveContainer(id, true, true) } if err != nil {