Repository navigation
Description
Summary
The backend Docker image build succeeds but the container crashes immediately on startup with ModuleNotFoundError: No module named 'canary'. The new src/backend/canary/ Python package was introduced but docker/backend/Dockerfile was not updated with a corresponding COPY instruction. This prevents trinity-backend from starting entirely.
Component
Backend / Docker Build
Priority
P1
Error
ModuleNotFoundError: No module named 'canary'
File "/app/routers/canary.py", line 21, in <module>
from canary import INVARIANTS
Location
- File:
docker/backend/Dockerfile - Line: COPY block (after existing
COPY ../../src/backend/routers /app/routers/) - Function/Class: N/A — build-time omission
Root Cause
The Dockerfile uses explicit per-directory COPY instructions rather than a wildcard COPY. When src/backend/canary/ was added as a new package, the Dockerfile was not updated to copy it into the image.
The build copies src/backend/routers/ (which now includes routers/canary.py), but does not copy the canary/ package itself — so the import at line 21 of routers/canary.py fails at container startup:
# Dockerfile currently has:
COPY ../../src/backend/routers /app/routers/ # copies routers/canary.py ✓
# COPY ../../src/backend/canary /app/canary/ # ← MISSING — package not in imageReproduction Steps
- Pull any commit from the batch that introduced
src/backend/canary/(e.g. commits merged around 2026-05-10) - Rebuild backend image:
docker compose -f docker-compose.prod.yml build backend - Start the container:
docker compose -f docker-compose.prod.yml up -d backend - Check logs:
docker logs trinity-backend --tail 30 - Observe
ModuleNotFoundError: No module named 'canary'— container exits unhealthy
Suggested Fix
Add a COPY instruction for the new canary/ package in docker/backend/Dockerfile, alongside the existing backend source copies:
COPY ../../src/backend/routers /app/routers/
COPY ../../src/backend/services /app/services/
COPY ../../src/backend/adapters /app/adapters/
COPY ../../src/backend/utils /app/utils/
COPY ../../src/backend/db /app/db/
COPY ../../src/backend/canary /app/canary/ # ← ADD THISEnvironment
- Trinity version: commit
9a57c6e2(first commit in batch introducingsrc/backend/canary/) - Affected file:
docker/backend/Dockerfile - OS: Ubuntu 22.04
Related
- New package introduced:
src/backend/canary/ - Router added:
src/backend/routers/canary.py(imports fromcanary) - Backend entrypoint updated:
src/backend/main.py(imports canary router + service) - Dockerfile:
docker/backend/Dockerfile
Activity
fix(docker): add missing COPY for canary/ package in backend Dockerfi…
vybe commentedon Jun 1, 2026
Shipped in v0.6.0 (released via #998).