Change ownership of the project volume mount directory to the quarkus user #128
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Container builds for a native images on a remote docker host are currently not possible (quarkusio/quarkus#1610). The issue is that the native build step mounts a volume to the build container containing the sources for the native image build and to which the final native image is written back to the host. However, volume mounts are not available for remote docker daemons. Still, using remote docker daemons is a pretty common scenario.
I outlined a solution to this problem in a comment on the above mentioned issue quarkusio/quarkus#1610 (comment), which is to copy the build sources into the container as well as copy the final native image out of the container back to the host, instead of using the volume mount. PR quarkusio/quarkus#14635 implements this strategy, which used to work with the build images provided on quay.io some time ago (late August, I think), but does not work with the newest images anymore. It seems to be a permission issue with the
/project
mount point. It is created with the root user when building the docker image, but written to using the quarkus user (uid 1001) when building the native image, which fails. The native image builds only work, when an actual directory on the host is mounted as a volume using the z-flag. The z-flag unfortunately does not work for anonymous or named volumes.The solution provided in this PR is to explicitly create the
/project
folder during the docker image build and let it be owned by thequarkus
user (created in theadd-quarkus-user
module) before the volume is created on it.