From 83902ccce0f3af01c03757f48a44498c023d56c1 Mon Sep 17 00:00:00 2001 From: Kees Bakker Date: Thu, 29 Sep 2022 20:59:42 +0200 Subject: [PATCH] makefiles/docker.inc.mk: add support for podman If podman is used for a docker build then use "--userns keep-id" instead of "--user $(id -u)". --- makefiles/docker.inc.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/makefiles/docker.inc.mk b/makefiles/docker.inc.mk index 76d3ef7e25..649495ef1a 100644 --- a/makefiles/docker.inc.mk +++ b/makefiles/docker.inc.mk @@ -118,13 +118,15 @@ DOCKER_OVERRIDE_CMDLINE += $(strip $(DOCKER_OVERRIDE_CMDLINE_AUTO)) # Overwrite if you want to use `docker` with sudo DOCKER ?= docker +_docker_is_podman = $(shell $(DOCKER) --version | grep podman 2>/dev/null) # Set default run flags: # - allocate a pseudo-tty # - remove container on exit # - set username/UID to executor DOCKER_USER ?= $$(id -u) -DOCKER_RUN_FLAGS ?= --rm --tty --user $(DOCKER_USER) +DOCKER_USER_OPT = $(if $(_docker_is_podman),--userns keep-id,--user $(DOCKER_USER)) +DOCKER_RUN_FLAGS ?= --rm --tty $(DOCKER_USER_OPT) # allow setting make args from command line like '-j' DOCKER_MAKE_ARGS ?=