Skip to content

Commit 508aeb9

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 7efb9d2 commit 508aeb9

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Makefile

+13-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)
@@ -128,6 +134,7 @@ define ENVIRONMENT_EXEC
128134
endef
129135

130136

137+
ifneq ($(CONTAINER_TOOL), unknown)
131138
ifeq ($(ENVIRONMENT_AUTOBUILD), true)
132139
define ENVIRONMENT_PREPARE
133140
@echo "Building the environment. (ENVIRONMENT_AUTOBUILD=true) This may take a few minutes..."
@@ -142,6 +149,11 @@ define ENVIRONMENT_PREPARE
142149
$(CONTAINER_TOOL) pull $(ENVIRONMENT_UPSTREAM)
143150
endef
144151
endif
152+
else
153+
define ENVIRONMENT_PREPARE
154+
$(error "Please install a container tool such as Docker or Podman")
155+
endef
156+
endif
145157

146158
.PHONY: check-container-tool
147159
check-container-tool: ## Checks what container tool is installed

0 commit comments

Comments
 (0)