Cannot run in Docker with user other than 1000
Quick Information
- Operating System: Linux
- Install Type: Docker
- Crafty Version: v4
What Happened?
When trying to run Crafty inside Docker container with user ID other than 1000, Crafty fails to launch, because it fails to write tempfile.txt to its root directory:
Unable to write to /crafty - Error: [Errno 13] Permission denied: '/crafty/tempfile.txt'
This happens because inside the container, the /crafty directory inside the container is owned by user caddy with UID 1000, so if the container is run as another user, that user won't have write access to that directory.
This may be similar to #661 and #452.
Expected result
Crafty should start properly, even if run as another user.
It seems the check is intended to make sure Crafty can create the log directory inside the root /crafty directory. However, because the logs directory is already mounted as a volume and already exists, the check is unnecessary. Perheps it could be removed entirely, so it fails only when it actually fails to create a required directory that does not exist yet.
Steps to reproduce
You should be able to reproduce the error with this Docker Compose file:
services:
crafty:
image: registry.gitlab.com/crafty-controller/crafty-4:latest
restart: unless-stopped
user: "500:500"
ports:
- "25565:25565" # Java
- "19132:19132/udp" # Bedrock
volumes:
- ./config:/crafty/app/config
- ./servers:/crafty/servers
- ./backups:/crafty/backups
- ./logs:/crafty/logs
- ./import:/crafty/import
Priority/Severity
- High (anything that impacts the normal user flow or blocks app usage)
- Medium (anything that negatively affects the user experience)
- Low (anything else e.g., typos, missing icons/translations, layout/formatting issues, etc.)