Skip to content

Commit

Permalink
Fix AppCDS generation when using podman
Browse files Browse the repository at this point in the history
We use the same trick as used in native-image
building

Fixes: quarkusio#38616
  • Loading branch information
geoand committed Feb 7, 2024
1 parent 2fc23dc commit 692a640
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,18 @@ private List<String> dockerRunCommands(OutputTargetBuildItem outputTarget, Strin
command.add(outputTarget.getOutputDirectory().toAbsolutePath().toString() + ":" + CONTAINER_IMAGE_BASE_BUILD_DIR
+ ":z");
if (SystemUtils.IS_OS_LINUX) {
String uid = getLinuxID("-ur");
String gid = getLinuxID("-gr");
if (uid != null && gid != null && !uid.isEmpty() && !gid.isEmpty()) {
command.add("--user");
command.add(uid + ":" + gid);
if (containerRuntime.isDocker() && containerRuntime.isRootless()) {
Collections.addAll(command, "--user", String.valueOf(0));
} else {
String uid = getLinuxID("-ur");
String gid = getLinuxID("-gr");
if (uid != null && gid != null && !uid.isEmpty() && !gid.isEmpty()) {
Collections.addAll(command, "--user", uid + ":" + gid);
if (containerRuntime.isPodman() && containerRuntime.isRootless()) {
// Needed to avoid AccessDeniedExceptions
command.add("--userns=keep-id");
}
}
}
}
command.add("-w");
Expand Down

0 comments on commit 692a640

Please sign in to comment.