This shows a warning message about adjusted file/directory permission bits
when the `docker build` cli command is executed on windows.
Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
| ... | ... |
@@ -227,6 +227,13 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
|
| 227 | 227 |
return err |
| 228 | 228 |
} |
| 229 | 229 |
} |
| 230 |
+ |
|
| 231 |
+ // windows: show error message about modified file permissions |
|
| 232 |
+ // FIXME: this is not a valid warning when the daemon is running windows. should be removed once docker engine for windows can build. |
|
| 233 |
+ if runtime.GOOS == "windows" {
|
|
| 234 |
+ log.Warn(`SECURITY WARNING: You are building a Docker image from Windows against a Linux 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.`) |
|
| 235 |
+ } |
|
| 236 |
+ |
|
| 230 | 237 |
var body io.Reader |
| 231 | 238 |
// Setup an upload progress bar |
| 232 | 239 |
// FIXME: ProgressReader shouldn't be this annoying to use |
| ... | ... |
@@ -4551,8 +4551,19 @@ func TestBuildStderr(t *testing.T) {
|
| 4551 | 4551 |
if err != nil {
|
| 4552 | 4552 |
t.Fatal(err) |
| 4553 | 4553 |
} |
| 4554 |
- if stderr != "" {
|
|
| 4555 |
- t.Fatalf("Stderr should have been empty, instead its: %q", stderr)
|
|
| 4554 |
+ |
|
| 4555 |
+ if runtime.GOOS == "windows" {
|
|
| 4556 |
+ // stderr might contain a security warning on windows |
|
| 4557 |
+ lines := strings.Split(stderr, "\n") |
|
| 4558 |
+ for _, v := range lines {
|
|
| 4559 |
+ if v != "" && !strings.Contains(v, "SECURITY WARNING:") {
|
|
| 4560 |
+ t.Fatalf("Stderr contains unexpected output line: %q", v)
|
|
| 4561 |
+ } |
|
| 4562 |
+ } |
|
| 4563 |
+ } else {
|
|
| 4564 |
+ if stderr != "" {
|
|
| 4565 |
+ t.Fatalf("Stderr should have been empty, instead its: %q", stderr)
|
|
| 4566 |
+ } |
|
| 4556 | 4567 |
} |
| 4557 | 4568 |
logDone("build - testing stderr")
|
| 4558 | 4569 |
} |