From 4cfa5b3265c068bb3f74337f9ec904beb53f3577 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 4 Nov 2025 23:04:44 +0000 Subject: [PATCH] Use DOCKER_HOST env var to find docker socket --- .../playwright-screenshots.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/element-web-playwright-common/playwright-screenshots.sh b/packages/element-web-playwright-common/playwright-screenshots.sh index a676491b28..ca4525fe40 100755 --- a/packages/element-web-playwright-common/playwright-screenshots.sh +++ b/packages/element-web-playwright-common/playwright-screenshots.sh @@ -24,6 +24,20 @@ build_image() { docker build -t "$IMAGE_NAME" --build-arg "PLAYWRIGHT_VERSION=$PW_VERSION" "$SCRIPT_DIR" } +# Find the docker socket on the host +case "$DOCKER_HOST" in + unix://*) + docker_sock="${DOCKER_HOST:7}" + ;; + "") + docker_sock="/var/run/docker.sock" + ;; + *) + echo "$0: unsupported DOCKER_HOST setting '${DOCKER_HOST}'" >&2 + exit 1; + ;; +esac + RUN_ARGS=( --rm --network host @@ -33,7 +47,7 @@ RUN_ARGS=( # Bind mount the working directory into the container -v $(pwd):/work/ # Bind mount the docker socket so we can run docker commands from the container - -v /var/run/docker.sock:/var/run/docker.sock + -v "${docker_sock}":/var/run/docker.sock # Bind mount /tmp so we can store temporary files -v /tmp/:/tmp/ -it