Add cli build warning about chmod bits on windows
| ... | ... |
@@ -232,6 +232,13 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
|
| 232 | 232 |
return err |
| 233 | 233 |
} |
| 234 | 234 |
} |
| 235 |
+ |
|
| 236 |
+ // windows: show error message about modified file permissions |
|
| 237 |
+ // FIXME: this is not a valid warning when the daemon is running windows. should be removed once docker engine for windows can build. |
|
| 238 |
+ if runtime.GOOS == "windows" {
|
|
| 239 |
+ 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.`) |
|
| 240 |
+ } |
|
| 241 |
+ |
|
| 235 | 242 |
var body io.Reader |
| 236 | 243 |
// Setup an upload progress bar |
| 237 | 244 |
// FIXME: ProgressReader shouldn't be this annoying to use |
| ... | ... |
@@ -4623,8 +4623,19 @@ func TestBuildStderr(t *testing.T) {
|
| 4623 | 4623 |
if err != nil {
|
| 4624 | 4624 |
t.Fatal(err) |
| 4625 | 4625 |
} |
| 4626 |
- if stderr != "" {
|
|
| 4627 |
- t.Fatalf("Stderr should have been empty, instead its: %q", stderr)
|
|
| 4626 |
+ |
|
| 4627 |
+ if runtime.GOOS == "windows" {
|
|
| 4628 |
+ // stderr might contain a security warning on windows |
|
| 4629 |
+ lines := strings.Split(stderr, "\n") |
|
| 4630 |
+ for _, v := range lines {
|
|
| 4631 |
+ if v != "" && !strings.Contains(v, "SECURITY WARNING:") {
|
|
| 4632 |
+ t.Fatalf("Stderr contains unexpected output line: %q", v)
|
|
| 4633 |
+ } |
|
| 4634 |
+ } |
|
| 4635 |
+ } else {
|
|
| 4636 |
+ if stderr != "" {
|
|
| 4637 |
+ t.Fatalf("Stderr should have been empty, instead its: %q", stderr)
|
|
| 4638 |
+ } |
|
| 4628 | 4639 |
} |
| 4629 | 4640 |
logDone("build - testing stderr")
|
| 4630 | 4641 |
} |