From 3143e954ce194efe85e7164febe745ee580ae815 Mon Sep 17 00:00:00 2001 From: Vlad Durnea Date: Sat, 31 Oct 2026 08:51:24 +0200 Subject: [PATCH] better-setup-docker v1: static CLI + socket verification --- README.md | 9 +++++++++ action.yml | 29 +++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 README.md create mode 100644 action.yml diff --git a/README.md b/README.md new file mode 100644 index 0000000..bf3e725 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# better-setup-docker + +Installs the pinned static docker CLI when the runner image lacks it, and proves the daemon +is reachable through the runner's socket mount (`docker info`) — fail early instead of deep +inside a job that needs containers. + +```yaml +- uses: https://git.madapes.com/actions/better-setup-docker@v1 +``` diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..d317687 --- /dev/null +++ b/action.yml @@ -0,0 +1,29 @@ +name: better-setup-docker +description: Install the pinned static docker CLI when missing and verify the runner's daemon socket works — for runners that mount the host docker socket. +inputs: + docker-version: + description: Exact docker CLI version to install when missing (x.y.z). + default: "27.5.1" + verify-socket: + description: Run `docker info` to prove the daemon socket is reachable ("true"/"false"). + default: "true" +runs: + using: composite + steps: + - shell: bash + run: | + set -euo pipefail + v="${{ inputs.docker-version }}" + if ! command -v docker >/dev/null 2>&1; then + case "$(uname -m)" in + x86_64|amd64) arch=x86_64 ;; + aarch64|arm64) arch=aarch64 ;; + *) echo "better-setup-docker: unsupported arch $(uname -m)" >&2; exit 1 ;; + esac + curl -fsSL "https://download.docker.com/linux/static/stable/${arch}/docker-${v}.tgz" | tar -xz -C /tmp docker + mv /tmp/docker/docker /usr/local/bin/docker + fi + docker --version + if [ "${{ inputs.verify-socket }}" = "true" ]; then + docker info >/dev/null && echo "docker ok (host socket)" + fi