Skip to content

Commit 4208a73

Browse files
script/build-with-container: skip dnf cache dir volume mounts on docker
When using docker the --volume option is not available during build (docker [buildx] build), unlike podman. Since passing these volumes must be conditional on them being set up I see no way to handle this short of just disabling the option on docker. Log the fact that it's being skipped - the only other issue is that we pointlessly set up some dirs and the build may be a bit slower. Signed-off-by: John Mulligan <[email protected]>
1 parent 612a9d6 commit 4208a73

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/script/build-with-container.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,11 @@ def build_container(ctx):
425425
]
426426
if ctx.cli.distro:
427427
cmd.append(f"--build-arg=DISTRO={ctx.from_image}")
428-
if ctx.dnf_cache_dir:
428+
if ctx.dnf_cache_dir and "docker" in ctx.container_engine:
429+
log.warning(
430+
"The --volume option is not supported by docker. Skipping dnf cache dir mounts"
431+
)
432+
elif ctx.dnf_cache_dir:
429433
cmd += [
430434
f"--volume={ctx.dnf_cache_dir}/lib:/var/lib/dnf:Z",
431435
f"--volume={ctx.dnf_cache_dir}:/var/cache/dnf:Z",

0 commit comments

Comments
 (0)