CRITICAL FIX: Settings UI was completely broken with EACCES permission denied
Problem:
- .env file on host owned by root:root
- Docker mounts .env as volume, retains host ownership
- Container runs as nextjs user (UID 1001) for security
- Settings API attempts fs.writeFileSync() → permission denied
- Users could NOT adjust position size, leverage, TP/SL, or any config
User escalation: "thats a major flaw. THIS NEEDS TO WORK."
Solution:
- Changed .env ownership on HOST to UID 1001 (nextjs user)
- chown 1001:1001 /home/icke/traderv4/.env
- Restarted container to pick up new permissions
- .env now writable by nextjs user inside container
Verified: Settings UI now saves successfully
Documented as Common Pitfall #39 with:
- Symptom, root cause, and impact
- Why docker exec chown fails (mounted files)
- Correct fix with UID matching
- Alternative solutions and tradeoffs
- Lesson about Docker volume mount ownership
Files changed:
- .github/copilot-instructions.md (added Pitfall #39)
- .env (ownership changed from root:root to 1001:1001)