Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.

Commit 6c9901c

Browse files
committed
Support Podman out of the box
While it was already possible to use podman by setting the DOCKER_CMD env var, this was not enough for most commands. This commit adds support for Podman out of the box. If Docker is installed, it will be preferred over Podman to stay backwards-compatible. The `--userns=keep-id` flag is required on Podman to ensure that 1.) the process in the container can write to the mounted workdirs, and 2.) ensure files created by processes in the container have the correct owner and group IDs: The ones from the user running the Make tasks. Signed-off-by: Manuel Hutter <manuel@hutter.io>
1 parent 572ec66 commit 6c9901c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

moduleroot/Makefile.vars.mk.erb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@ root_volume ?= -v "$${PWD}:/$(COMPONENT_NAME)"
1212
compiled_volume ?= -v "$${PWD}/$(compiled_path):/$(COMPONENT_NAME)"
1313
commodore_args ?= --search-paths ./dependencies --search-paths .
1414

15-
DOCKER_CMD ?= docker
16-
DOCKER_ARGS ?= run --rm -u "$$(id -u):$$(id -g)" -w /$(COMPONENT_NAME) -e HOME="/$(COMPONENT_NAME)"
15+
ifneq "$(shell which docker 2>/dev/null)" ""
16+
DOCKER_CMD ?= $(shell which docker)
17+
DOCKER_USERNS ?= ""
18+
else
19+
DOCKER_CMD ?= podman
20+
DOCKER_USERNS ?= keep-id
21+
endif
22+
DOCKER_ARGS ?= run --rm -u "$$(id -u):$$(id -g)" --userns=$(DOCKER_USERNS) -w /$(COMPONENT_NAME) -e HOME="/$(COMPONENT_NAME)"
1723

1824
JSONNET_FILES ?= $(shell find . -type f -not -path './vendor/*' \( -name '*.*jsonnet' -or -name '*.libsonnet' \))
1925
JSONNETFMT_ARGS ?= --in-place --pad-arrays

0 commit comments

Comments
 (0)