Skip to content

Commit 3bacc99

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]> (cherry picked from commit af65ee4) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent f77defa commit 3bacc99

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
@@ -10,7 +10,6 @@ import (
1010
"io"
1111
"os"
1212
"path/filepath"
13-
"runtime"
1413
"strings"
1514

1615
"github.com/distribution/reference"
@@ -385,16 +384,6 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
385384
return err
386385
}
387386

388-
// Windows: show error message about modified file permissions if the
389-
// daemon isn't running Windows.
390-
if response.OSType != "windows" && runtime.GOOS == "windows" && !options.quiet {
391-
_, _ = fmt.Fprintln(dockerCli.Out(), "SECURITY WARNING: You are building a Docker "+
392-
"image from Windows against a non-Windows Docker host. All files and "+
393-
"directories added to build context will have '-rwxr-xr-x' permissions. "+
394-
"It is recommended to double check and reset permissions for sensitive "+
395-
"files and directories.")
396-
}
397-
398387
// Everything worked so if -q was provided the output from the daemon
399388
// should be just the image ID and we'll print that to stdout.
400389
if options.quiet {

0 commit comments

Comments
 (0)