Skip to content

Commit 22b4f6c

Browse files
andrew-m-leonardluhenry
authored andcommitted
Enable docker builds when emulated by podman (adoptium#716)
Signed-off-by: Andrew Leonard <[email protected]>
1 parent fc3d34a commit 22b4f6c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pipelines/build/common/openjdk_build_pipeline.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,6 +1817,14 @@ class Build {
18171817
} else {
18181818
dockerImageDigest = dockerImageDigest.replaceAll("\\[", "").replaceAll("\\]", "")
18191819
String dockerRunArg="-e \"BUILDIMAGESHA=$dockerImageDigest\""
1820+
1821+
// Are we running podman in Docker CLI Emulation mode?
1822+
def isPodman = context.sh(script: "docker --version | grep podman", returnStatus:true)
1823+
if (isPodman == 0) {
1824+
// Note: --userns was introduced in podman 4.3.0
1825+
// Add uid and gid userns mapping required for podman
1826+
dockerRunArg += " --userns keep-id:uid=1000,gid=1000"
1827+
}
18201828
context.docker.image(buildConfig.DOCKER_IMAGE).inside(buildConfig.DOCKER_ARGS+" "+dockerRunArg) {
18211829
buildScripts(
18221830
cleanWorkspace,

0 commit comments

Comments
 (0)