ci: 由 VM 任务启动本地 Docker daemon
test / shell (pull_request) Successful in 41s
test / python (pull_request) Successful in 1m29s
test / go (pull_request) Successful in 3m7s

This commit is contained in:
2026-09-21 12:00:55 +00:00
parent 51b940468e
commit fef7e5a214
2 changed files with 44 additions and 3 deletions
+39
View File
@@ -9,6 +9,45 @@ jobs:
kind:
runs-on: [self-hosted, vm-dev]
steps:
- name: Start job-local Docker
shell: bash
run: |
set -euo pipefail
sudo install -d /var/lib/docker
sudo truncate -s 20G /tmp/docker-data.img
sudo mkfs.ext4 -F /tmp/docker-data.img
sudo mount -o loop /tmp/docker-data.img /var/lib/docker
# A nested systemd needs a domain cgroup namespace. This is the
# cgroup v2 nesting initialization performed by the official DinD
# entrypoint, kept here because the shared runner image deliberately
# does not carry a second DinD-specific entrypoint.
if [[ -f /sys/fs/cgroup/cgroup.controllers ]]; then
sudo sh -c '
mkdir -p /sys/fs/cgroup/init
while read -r pid; do
printf "%s\n" "$pid" \
>/sys/fs/cgroup/init/cgroup.procs 2>/dev/null || true
done </sys/fs/cgroup/cgroup.procs
sed -e "s/ / +/g" -e "s/^/+/" \
/sys/fs/cgroup/cgroup.controllers \
>/sys/fs/cgroup/cgroup.subtree_control
'
fi
sudo nohup dockerd \
--host=unix:///var/run/docker.sock \
--storage-driver=overlay2 \
>/tmp/dockerd.log 2>&1 &
for _ in {1..60}; do
if docker info >/dev/null 2>&1; then
exit 0
fi
sleep 1
done
cat /tmp/dockerd.log
exit 1
- name: Verify Docker
shell: bash
run: |