Skip to content

Commit 2479e2f

Browse files
committed
fix(dev): fix detection of container tool in make
Fixes the following error when `ENVIRONMENT=true` and neither Docker or Podman are available: make: podman: No such file or directory make: *** [Makefile:174: build] Error 127 Podman was being used as fallback even if also not available. A descriptive error is now reported instead in this situation. Signed-off-by: Hugo Hromic <[email protected]>
1 parent 7b9f655 commit 2479e2f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Makefile

+10-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ export VERBOSE ?= false
3434
# Override the container tool. Tries docker first and then tries podman.
3535
export CONTAINER_TOOL ?= auto
3636
ifeq ($(CONTAINER_TOOL),auto)
37-
override CONTAINER_TOOL = $(shell docker version >/dev/null 2>&1 && echo docker || echo podman)
37+
ifeq ($(shell docker version >/dev/null 2>&1 && echo docker), docker)
38+
override CONTAINER_TOOL = docker
39+
else ifeq ($(shell podman version >/dev/null 2>&1 && echo podman), podman)
40+
override CONTAINER_TOOL = podman
41+
else
42+
override CONTAINER_TOOL = unknown
43+
endif
3844
endif
3945
# If we're using podman create pods else if we're using docker create networks.
4046
export CURRENT_DIR = $(shell pwd)
@@ -108,6 +114,9 @@ endif
108114

109115
# We use a volume here as non-Linux hosts are extremely slow to share disks, and Linux hosts tend to get permissions clobbered.
110116
define ENVIRONMENT_EXEC
117+
ifeq $($(CONTAINER_TOOL), unknown)
118+
$(error "Please install a container tool such as Docker or Podman")
119+
endif
111120
${ENVIRONMENT_PREPARE}
112121
@echo "Entering environment..."
113122
@mkdir -p target

0 commit comments

Comments
 (0)