From: John Mulligan Date: Thu, 20 Feb 2025 14:50:49 +0000 (-0500) Subject: script/build-with-container: skip dnf cache dir volume mounts on docker X-Git-Tag: v19.2.3~318^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5b0a01d03bdce98e0b8bb17f2879d3f9598474d6;p=ceph.git 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 (cherry picked from commit 4208a736652190fdaad3006c435f6c068e81a093) --- diff --git a/src/script/build-with-container.py b/src/script/build-with-container.py index f1e5bcd77fe0..2cd1d4d3ad19 100755 --- a/src/script/build-with-container.py +++ b/src/script/build-with-container.py @@ -425,7 +425,11 @@ def build_container(ctx): ] if ctx.cli.distro: cmd.append(f"--build-arg=DISTRO={ctx.from_image}") - if ctx.dnf_cache_dir: + if ctx.dnf_cache_dir and "docker" in ctx.container_engine: + log.warning( + "The --volume option is not supported by docker. Skipping dnf cache dir mounts" + ) + elif ctx.dnf_cache_dir: cmd += [ f"--volume={ctx.dnf_cache_dir}/lib:/var/lib/dnf:Z", f"--volume={ctx.dnf_cache_dir}:/var/cache/dnf:Z",