From af65ee4584196d543a3d548de4de97b62850505e Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 5 Sep 2025 13:30:47 +0200 Subject: [PATCH] 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]: https://github.com/moby/moby/commit/4a8b3cad6096854027151dfbcfb4b2cd8841ad95 [moby@535c4c9]: https://github.com/moby/moby/commit/535c4c9a59b1e58c897677d6948a595cb3d28639 Signed-off-by: Sebastiaan van Stijn --- cli/command/image/build.go | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/cli/command/image/build.go b/cli/command/image/build.go index 27d4fe39b..0b3c76e8a 100644 --- a/cli/command/image/build.go +++ b/cli/command/image/build.go @@ -8,7 +8,6 @@ import ( "io" "os" "path/filepath" - "runtime" "strings" "github.com/distribution/reference" @@ -361,16 +360,6 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions) return err } - // Windows: show error message about modified file permissions if the - // daemon isn't running Windows. - if response.OSType != "windows" && runtime.GOOS == "windows" && !options.quiet { - _, _ = fmt.Fprintln(dockerCli.Out(), "SECURITY WARNING: You are building a Docker "+ - "image from Windows against a non-Windows Docker host. All files and "+ - "directories added to build context will have '-rwxr-xr-x' permissions. "+ - "It is recommended to double check and reset permissions for sensitive "+ - "files and directories.") - } - // Everything worked so if -q was provided the output from the daemon // should be just the image ID and we'll print that to stdout. if options.quiet {