Skip to content

fix: handle Docker named volume for .venv in dev entrypoint#36

Merged
xprilion merged 4 commits intoxprilion:mainfrom
silasly:fix/dockerfile-dev-venv-volume
Apr 30, 2026
Merged

fix: handle Docker named volume for .venv in dev entrypoint#36
xprilion merged 4 commits intoxprilion:mainfrom
silasly:fix/dockerfile-dev-venv-volume

Conversation

@silasly
Copy link
Copy Markdown
Contributor

@silasly silasly commented Apr 30, 2026

Closes #35

Description

When running the dev Docker setup on ARM64 (Raspberry Pi) or any system where .venv is mounted as a Docker named volume, the entrypoint fails because rm -rf /app/backend/.venv returns Device or resource busy.

Docker named volumes cannot be removed with rm -rf — the directory persists in the volume store. This causes the dev environment to crash-loop on container start.

Fix

  1. Attempt rm -rf /app/backend/.venv first (works for bind mounts / plain directories)
  2. Fall back to uv venv --clear which clears contents without removing the directory — works on Docker volumes

Testing

  • ✅ Tested on Raspberry Pi 5 (ARM64, Debian trixie) with Docker Compose
  • ✅ All services (db, redis, web, worker, frontend, docs) start successfully

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves the dev Docker entrypoint’s resilience when .venv is backed by a Docker named volume (common on ARM64/Raspberry Pi), avoiding crash-loops caused by attempting to rm -rf a mounted volume directory.

Changes:

  • Make .venv cleanup tolerant of Docker named volumes by ignoring rm -rf failure and clearing via uv venv --clear.
  • Add a “sync dependencies” step when the venv is already valid.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Dockerfile.dev Outdated
# Venv exists and works, but ensure watchmedo is there too
# Venv works — run uv sync to pick up any new/changed dependencies
echo "[dev-entrypoint] Syncing dependencies..."
cd /app/backend && uv sync --quiet 2>/dev/null || true
Comment thread Dockerfile.dev Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the dev Docker entrypoint to avoid crash-loops when .venv is mounted as a Docker named volume (where deleting the mountpoint directory fails), ensuring dependencies can still be reinstalled/cleared reliably in dev setups (including ARM64).

Changes:

  • Capture and warn on failures when attempting to rm -rf /app/backend/.venv, then fall back to uv venv --clear to clear the environment without removing the directory.
  • Add a best-effort uv sync on startup when an existing venv is detected as working.
  • Keep watchmedo installation as a guard when missing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Dockerfile.dev Outdated
xprilion and others added 2 commits April 30, 2026 22:37
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@xprilion xprilion merged commit 931578e into xprilion:main Apr 30, 2026
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: Docker named volume prevents .venv cleanup in dev entrypoint on ARM64

3 participants