From 7f1f1260916bb7555961300c3a87b6099f6c6ebd Mon Sep 17 00:00:00 2001 From: Thieu Nguyen <79964592+thieung@users.noreply.github.com> Date: Fri, 20 Mar 2026 07:53:29 +0700 Subject: [PATCH] fix(docker): make runtime dir creation non-fatal in entrypoint (#288) On first start with a fresh Docker volume, mkdir for .runtime subdirectories can fail due to a volume initialisation race condition, causing the container to restart loop. The directories are only needed for agent-installed packages (pip/npm), so the failure is non-fatal. --- docker-entrypoint.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 6f14d58e..99807c3e 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -4,14 +4,17 @@ set -e # Set up writable runtime directories for agent-installed packages. # Rootfs is read-only; /app/data is a writable Docker volume. RUNTIME_DIR="/app/data/.runtime" -mkdir -p "$RUNTIME_DIR/pip" "$RUNTIME_DIR/npm-global/lib" +# Non-fatal: on first start with a fresh volume the directory may not be +# writable yet (volume initialisation race on some Docker runtimes). +# The app starts fine without .runtime; package installs will fail gracefully. +mkdir -p "$RUNTIME_DIR/pip" "$RUNTIME_DIR/npm-global/lib" || true # Python: allow agent to pip install to writable target dir export PYTHONPATH="$RUNTIME_DIR/pip:${PYTHONPATH:-}" export PIP_TARGET="$RUNTIME_DIR/pip" export PIP_BREAK_SYSTEM_PACKAGES=1 export PIP_CACHE_DIR="$RUNTIME_DIR/pip-cache" -mkdir -p "$RUNTIME_DIR/pip-cache" +mkdir -p "$RUNTIME_DIR/pip-cache" || true # Node.js: allow agent to npm install -g to writable prefix # NODE_PATH includes both pre-installed system globals and runtime-installed globals.