From 58a30c8d21790340a70bb0757720834cd57e6766 Mon Sep 17 00:00:00 2001 From: jakeiotechsys Date: Fri, 30 Aug 2024 14:23:27 +0100 Subject: [PATCH 1/2] fix: portainer docker rootless Changed how docker rootless environment is resolved and env var is assigned Signed-off-by: jakeiotechsys --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 825b8015..6fb69d60 100644 --- a/Makefile +++ b/Makefile @@ -30,8 +30,11 @@ DOCKER_COMPOSE=docker compose # Resolve user ID for rootless docker port mapping export USERID:=$(shell id -u) -# Set default rootful docker socket path +# Set default rootful docker socket path otherwise detect rootless path export DOCKER_SOCKET_PATH=/var/run/docker.sock +ifneq (,$(wildcard /run/user/$(USERID)/docker.sock)) + export DOCKER_SOCKET_PATH := /run/user/$(USERID)/docker.sock +endif ifeq (arm64, $(filter arm64,$(ARGS))) ARM64=-arm64 @@ -58,9 +61,6 @@ endef .PHONY: $(OPTIONS) portainer: - @if [ -e /run/user/${USERID}/docker.sock ]; then \ - export DOCKER_SOCKET_PATH=/run/user/${USERID}/docker.sock; \ - fi ${DOCKER_COMPOSE} -p portainer -f docker-compose-portainer.yml up -d portainer-down: From c00e310247cf7eb725d1bf3190d1679e10cae1e1 Mon Sep 17 00:00:00 2001 From: jakeiotechsys Date: Fri, 30 Aug 2024 14:24:37 +0100 Subject: [PATCH 2/2] fix: portainer docker rootless Corrected comment Signed-off-by: jakeiotechsys --- compose-builder/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose-builder/Makefile b/compose-builder/Makefile index ab59b2ba..511e9a5f 100644 --- a/compose-builder/Makefile +++ b/compose-builder/Makefile @@ -143,7 +143,7 @@ endif # When in delay-start mode, ensure support services are delay-start-compliant by adding runtime-token configuration ifeq (delayed-start,$(filter delayed-start,$(ARGS))) - # Ensure Docker is running rootless, as security-spire-agent runs only in Docker rootless mode + # Resolve docker rootless environment ifneq (,$(wildcard /run/user/$(USERID)/docker.sock)) export DOCKER_SOCKET_PATH := /run/user/$(USERID)/docker.sock endif