Docker on Windows with Dart Docker Image

2019-05-11 08:36发布

问题:

How does this warning need to be addressed for a dart runtime docker image to be secure? The docker image will ultimately be hosted in the google cloud.

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."

回答1:

The issue 20397 explains (credit: Sebastiaan van Stijn - thaJeztah)

That warning was added, because the Windows filesystem does not have an option to mark a file as 'executable'.
Building a linux image from a Windows machine would therefore break the image if a file has to be marked executable.

For that reason, files are marked executable by default when building from a windows client; the warning is there so that you are notified of that, and (if needed), modify the Dockerfile to change/remove the executable bit afterwards.

I like to add in the Dockerfile, after a COPY, a RUN CHMOD +x aFile_I_Just_Copied