Skip to content

Commit af65ee4

Browse files
committed
cli/command/image: build: remove permissions warning on Windows
This warning was added in [moby@4a8b3ca] to print a warning when building Linux images from a Windows client. Window's filesystem does not have an "executable" bit, which mean that, for example, copying a shell script to an image during build would lose the executable bit. So for Windows clients, the executable bit would be set on all files, unconditionally. Originally this was detected in the client, which had direct access to the API response headers, but when refactoring the client to use a common library in [moby@535c4c9], this was refactored into a `ImageBuildResponse` wrapper, deconstructing the API response into an `io.Reader` and a string field containing only the `OSType` header. This was the only use and only purpose of the `OSType` field, and now that BuildKit is the default builder for Linux images, this warning didn't get printed unless BuildKit was explicitly disabled. This patch removes the warning, so that we can potentially remove the field, or the `ImageBuildResponse` type altogether. [moby@4a8b3ca]: moby/moby@4a8b3ca [moby@535c4c9]: moby/moby@535c4c9 Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 4ceef7d commit af65ee4

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

cli/command/image/build.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"io"
99
"os"
1010
"path/filepath"
11-
"runtime"
1211
"strings"
1312

1413
"github.com/distribution/reference"
@@ -361,16 +360,6 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
361360
return err
362361
}
363362

364-
// Windows: show error message about modified file permissions if the
365-
// daemon isn't running Windows.
366-
if response.OSType != "windows" && runtime.GOOS == "windows" && !options.quiet {
367-
_, _ = fmt.Fprintln(dockerCli.Out(), "SECURITY WARNING: You are building a Docker "+
368-
"image from Windows against a non-Windows Docker host. All files and "+
369-
"directories added to build context will have '-rwxr-xr-x' permissions. "+
370-
"It is recommended to double check and reset permissions for sensitive "+
371-
"files and directories.")
372-
}
373-
374363
// Everything worked so if -q was provided the output from the daemon
375364
// should be just the image ID and we'll print that to stdout.
376365
if options.quiet {

0 commit comments

Comments
 (0)