Skip to content

Commit

Permalink
Merge pull request #38644 from geoand/#38616
Browse files Browse the repository at this point in the history
Fix AppCDS generation when using podman
  • Loading branch information
geoand authored Feb 7, 2024
2 parents 7fb6adb + 692a640 commit 90f1c28
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 90f1c28

Please sign in to comment.