diff --git a/builder/remotecontext/detect.go b/builder/remotecontext/detect.go index 22ad5b7c9f..4345736805 100644 --- a/builder/remotecontext/detect.go +++ b/builder/remotecontext/detect.go @@ -131,6 +131,7 @@ func removeDockerfile(c modifiableContext, filesToRemove ...string) error { } excludes, err := dockerignore.ReadAll(f) if err != nil { + f.Close() return err } f.Close()