Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: portainer docker rootless #461

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion compose-builder/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down