Skip to content

Commit b0a8550

Browse files
committed
fix: move Docker image pre-pull to sandbox startup (image build lacks mount privs)
The pre-pull of base images (node:22-alpine, python:3.12-alpine) cannot run during Modal image build because the builder lacks mount privileges for tmpfs. Move it to sandbox startup where dockerd runs as root with full capabilities and the tmpfs-backed overlay2 storage works correctly.
1 parent a8e28fe commit b0a8550

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

app.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -219,17 +219,10 @@ def _get_gpu_config(gpu_key: str):
219219
"update-alternatives --set iptables /usr/sbin/iptables-legacy",
220220
"update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy",
221221
)
222-
# Layer 1b: Pre-pull common base images using Modal's optimized image system
223-
# This avoids 140s+ Docker pulls through gVisor's slow netstack at runtime.
222+
# Layer 1b: Include start-dockerd.sh for runtime pre-pull (moved earlier
223+
# into a stable layer so it's cached alongside Docker setup).
224224
.add_local_file(_TEMP_DOCKERD_PATH, "/start-dockerd.sh", copy=True)
225225
.run_commands("chmod +x /start-dockerd.sh")
226-
.run_commands(
227-
"bash /start-dockerd.sh & sleep 5 && until docker info >/dev/null 2>&1; do sleep 1; done",
228-
"docker pull node:22-alpine",
229-
"docker pull python:3.12-alpine",
230-
"docker pull alpine:3.19",
231-
"kill %1 2>/dev/null || true",
232-
)
233226
# Layer 2: Python deps (semi-stable)
234227
.apt_install("python3", "python3-pip", "python-is-python3")
235228
.pip_install("fastapi==0.115.0", "httpx==0.27.0")
@@ -744,6 +737,8 @@ async def github_webhook(request: Request):
744737
"bash -c '/start-dockerd.sh &'"
745738
" && sleep 5"
746739
" && until docker info > /dev/null 2>&1; do sleep 1; done"
740+
" && docker pull node:22-alpine"
741+
" && docker pull python:3.12-alpine"
747742
" && cd /actions-runner"
748743
" && export RUNNER_ALLOW_RUNASROOT=1"
749744
" && export DOCKER_BUILDKIT=1"

0 commit comments

Comments
 (0)