better-setup-docker v1: static CLI + socket verification

This commit is contained in:
2026-10-31 08:51:24 +02:00
commit 3143e954ce
2 changed files with 38 additions and 0 deletions
+9
View File
@@ -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
```
+29
View File
@@ -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