sbt-native-packager icon indicating copy to clipboard operation
sbt-native-packager copied to clipboard

DockerPermissionStrategy.MultiStage relies on COPY --chown

Open nadavwr opened this issue 5 years ago • 3 comments

DockerPermissionStrategy.MultiStage is made available from Docker 17.05 onwards. However, it generates a COPY --chown, which is only available from 17.09 onwards.

As a result we encounter failures running docker build against Docker 17.06.

nadavwr avatar Feb 12 '20 12:02 nadavwr

Thanks for your bug report.

This is the responsible code snippet. For me it looks like we check for 17.09 or higher. Could it be that the API version is too low?

muuki88 avatar Feb 20 '20 12:02 muuki88

The problem is with the multiStage snippet. It checks for 17.05, then uses makeCopyFrom, which in turn uses `COPY --from=... --chown=....

COPY --from=... --chown=... has the same version availability as COPY --chown (from 17.09 onwards).

A separate MultiStage permission strategy should have been viable without --chown (I assume this was the original intent). However, up until 19.03.07 ownership wasn't preserved when copying from previous stages—in effect forcing the --chown flag in both strategies.

nadavwr avatar Mar 09 '20 11:03 nadavwr

I had the same problem, as the docker in my CI is 17.05 and it doesn't support COPY --chown.

For those who stumble upon this, a temporary fix is to change the permission strategy

dockerPermissionStrategy := DockerPermissionStrategy.Run

giuscri avatar May 27 '20 10:05 giuscri