Skip to content

Commit

Permalink
Enable docker builds when emulated by podman (#716)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Leonard <[email protected]>
  • Loading branch information
andrew-m-leonard authored Jun 8, 2023
1 parent b3ad946 commit b6a9e4e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pipelines/build/common/openjdk_build_pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1817,6 +1817,14 @@ class Build {
} else {
dockerImageDigest = dockerImageDigest.replaceAll("\\[", "").replaceAll("\\]", "")
String dockerRunArg="-e \"BUILDIMAGESHA=$dockerImageDigest\""

// Are we running podman in Docker CLI Emulation mode?
def isPodman = context.sh(script: "docker --version | grep podman", returnStatus:true)
if (isPodman == 0) {
// Note: --userns was introduced in podman 4.3.0
// Add uid and gid userns mapping required for podman
dockerRunArg += " --userns keep-id:uid=1000,gid=1000"
}
context.docker.image(buildConfig.DOCKER_IMAGE).inside(buildConfig.DOCKER_ARGS+" "+dockerRunArg) {
buildScripts(
cleanWorkspace,
Expand Down

0 comments on commit b6a9e4e

Please sign in to comment.