From 63e8f3228106712ac162fbcd12d0530d532152e7 Mon Sep 17 00:00:00 2001 From: Yusuke Kuoka Date: Fri, 4 Nov 2022 06:46:21 +0900 Subject: [PATCH] Fix permission issue when you use PV for rootless dind cache (#1977) * Fix permission issue when you use PV for rootless dind cache This fixes the said issue I have found while testing #1759. Signed-off-by: Yusuke Kuoka --- runner/entrypoint-dind-rootless.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/runner/entrypoint-dind-rootless.sh b/runner/entrypoint-dind-rootless.sh index fb7234c7..352ee0ec 100644 --- a/runner/entrypoint-dind-rootless.sh +++ b/runner/entrypoint-dind-rootless.sh @@ -22,6 +22,17 @@ jq ".\"registry-mirrors\"[0] = \"${DOCKER_REGISTRY_MIRROR}\"" /home/runner/.conf fi SCRIPT +if [ -d /home/runner/.local ]; then + if [ ! -d /home/runner/.local/share ]; then + log.notice "Creating /home/runner/.local/share owned by runner:runner \ +so that rootless dockerd will not fail with a permission error when creating /home/runner/.local/share/docker" + + sudo mkdir /home/runner/.local/share + sudo chmod 755 /home/runner/.local/share + sudo chown runner:runner /home/runner/.local/share + fi +fi + log.notice "Starting Docker (rootless)" dumb-init bash <<'SCRIPT' &