diff --git a/docker-compose/Makefile b/docker-compose/Makefile
index 6c6e3c888eaa77b7c23ad0fca6ec0d94a8099bf7..5a667713ed71e480737ec434d04509ac73f1c82e 100644
--- a/docker-compose/Makefile
+++ b/docker-compose/Makefile
@@ -77,12 +77,14 @@ else
     UNAME_S := $(shell uname -s)
 
     ifeq ($(UNAME_S),Linux)
+        DOCKER_GID ?= $(shell getent group docker | cut -d: -f 3)
         DISPLAY ?= :0.0
         XAUTHORITY_MOUNT := /tmp/.X11-unix:/tmp/.X11-unix
         XAUTHORITY ?= /hosthome/.Xauthority
         # /bin/sh (=dash) does not evaluate 'docker network' conditionals correctly
         SHELL := /bin/bash
     else ifeq ($(UNAME_S),Darwin)
+        DOCKER_GID ?= $(shell id -g)
         IF_INTERFACE := $(shell scutil --nwi | grep 'Network interfaces:' | cut -d' ' -f3)
         IP_ADDRESS := $(shell scutil --nwi | grep 'address' | cut -d':' -f2 | tr -d ' ' | head -n1)
         DISPLAY := $(IP_ADDRESS):0
@@ -126,7 +128,7 @@ DOCKER_COMPOSE_ARGS := DISPLAY=$(DISPLAY) \
     CONTAINER_NAME_PREFIX=$(CONTAINER_NAME_PREFIX) \
     COMPOSE_IGNORE_ORPHANS=true \
     CONTAINER_EXECUTION_UID=$(shell id -u) \
-    DOCKER_GID=$(shell getent group docker | cut -d: -f 3)
+    DOCKER_GID=$(DOCKER_GID)
 
 
 .PHONY: up down minimal start stop restart build build-nocache status clean pull help