From 25b6a6eceeb8b13ba1827649a0d6586dd65f11aa Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Sun, 16 Feb 2025 18:03:50 +0100 Subject: [PATCH] utils/docker-run: allow explicitly setting of docker/podman/... Currently, our docker-run helper will decide on its own whether it should use docker (preferred) or podman (fallback), as introduced in 9a629f5129d6 (utils/docker-run: allow running with Podman). In case both are installed, it is not possible to exercise the podman case. Often, 'docker' is just an alias for 'podman' when both are available, but this is not always true - and in the latter case, the user needs to be able to choose which one they want. Allow the user to force the one to use, by setting the BR2_DOCKER environment variable. If that is set and it doesn't exist, exit with an explicit error message (rather than relying on the failure when eventually exec-ing the specified command). Signed-off-by: Yann E. MORIN Cc: Ricardo Martincoski Cc: Julien Olivain Cc: Fiona Klute Reviewed-by: Fiona Klute (WIWA) Signed-off-by: Arnout Vandecappelle --- utils/docker-run | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/utils/docker-run b/utils/docker-run index 849df66d54..27c169db72 100755 --- a/utils/docker-run +++ b/utils/docker-run @@ -35,7 +35,14 @@ declare -a mountpoints=( # compatibility command. export PODMAN_USERNS="keep-id" -if command -v docker >/dev/null; then +if [ "${BR2_DOCKER}" ]; then + if command -v "${BR2_DOCKER}" >/dev/null; then + DOCKER="${BR2_DOCKER}" + else + printf 'ERROR: Command "%s" (from env BR2_DOCKER) not found.\n' "${BR2_DOCKER}" >&2 + exit 1 + fi +elif command -v docker >/dev/null; then DOCKER="docker" elif command -v podman >/dev/null; then DOCKER="podman"