Initial commit: Gitea CI jobs in gVisor with sandboxed Docker
This commit is contained in:
commit
6c14f5d76d
17 files changed
+1084
No files matched your search
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Runs inside the runner container (not inside gVisor). It asks the runner's
|
||||
# private dockerd to launch a second, gVisor-sandboxed Docker daemon and shares
|
||||
# only that daemon's socket volume with CI jobs.
|
||||
|
||||
docker volume create gvisor-dind-data >/dev/null
|
||||
|
||||
docker rm -f gvisor-dind >/dev/null 2>&1 || true
|
||||
docker run -d \
|
||||
--name gvisor-dind \
|
||||
--restart unless-stopped \
|
||||
--runtime=runsc-net \
|
||||
--privileged \
|
||||
-p 127.0.0.1:2375:2375 \
|
||||
-v gvisor-dind-data:/var/lib/docker \
|
||||
-v /opt/gvisor-dind/start-dind.sh:/opt/gvisor-dind/start-dind.sh:ro \
|
||||
--entrypoint /opt/gvisor-dind/start-dind.sh \
|
||||
docker:28-dind >/dev/null
|
||||
|
||||
echo "Waiting for the sandboxed Docker daemon..."
|
||||
for _ in $(seq 1 120); do
|
||||
if docker exec gvisor-dind docker info >/dev/null 2>&1; then
|
||||
echo "Sandboxed Docker daemon is ready."
|
||||
exit 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "Sandboxed Docker daemon did not become ready" >&2
|
||||
docker logs --tail 120 gvisor-dind >&2 || true
|
||||
exit 1
|
||||
Reference in new issue
Block a user