-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AppCDS containerized generation runs with UID 1000 which can clash with an existing user with UID 1000 on the host #38616
Comments
I definitely understand the sentiment here, but I would like to avoid this if possible since adding arbitrary arguments to the AppCDS generation command could lead to unexpected results.
I wonder if any of our folks who use podman can confirm this is the right thing to do. @zakkak maybe? |
Yes, this sounds like the right thing to do, and we actually do it already for native builds when using a builder image. |
Cool, thanks |
We use the same trick as used in native-image building Fixes: quarkusio#38616
@davidreis97 mind giving #38644 a try? |
Fix AppCDS generation when using podman
We use the same trick as used in native-image building Fixes: quarkusio#38616 (cherry picked from commit 692a640)
@geoand The fix works on my side. Thanks for the usual responsiveness! |
Thank you for the spot on investigation of the problem! |
Describe the bug
In my current setup, when creating an AppCDS archive using the property
quarkus.package.create-appcds=true
and executingmvn package -Dquarkus.container-image.build=true
, the user that is running the mvn command has a UID 1000 and GID 1000.To create the appcds archive, the following command is run:
podman run -v /devfolder/target:/tmp/quarkus:z --user 1000:1000 -w /tmp/quarkus/quarkus-app --rm registry.access.redhat.com/ubi8/openjdk-21-runtime:1.18 java -XX:ArchiveClassesAtExit=app-cds.jsa -Dquarkus.appcds.generate=true -jar quarkus-run.jar
Since the /target folder has 755 permission octal and the user with UID 1000 that exists on the host does not exist in the
/etc/passwd
of the container that podman spawns, the container is unable to write the archive to the folder. The creation fails with the following error:[9.824s][error ][cds] Unable to create shared archive file app-cds.jsa: (Permission denied).
I was able to fix this by adding the argument argument
--userns=keep-id
to thepodman run
command. As you can see here this argument ensures that the current user in my host also exists in the/etc/passwd
of the container. However, I didn't find any way to pass this command in the current AppCDS flow.As I mentioned in #38020, albeit in a different context, I feel like the best solution here would be to allow the dev to add arguments or modify the command that gets called, since that fixes not just my issue but any other that may arise.
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
No response
Output of
uname -a
orver
Darwin <computer_name> 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 arm64 arm Darwin
Output of
java -version
openjdk version "21.0.1" 2023-10-17 OpenJDK Runtime Environment (build 21.0.1+12-29) OpenJDK 64-Bit Server VM (build 21.0.1+12-29, mixed mode, sharing)
Quarkus version or git rev
Quarkus 3.7.1
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.6
Additional information
No response
The text was updated successfully, but these errors were encountered: