5 months ago
I deployed new service via dropping docker compose file. It has configured volume. The volume is appeared but deploy script can't use it due to deploy because of permission denied. How can I fix it?
Logs:
Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/dc4935a6-48c5-455f-8320-ddfce6ac0655/vol_zd1w91epls1sq6ax
Database not found. Initializing...
/usr/local/bin/docker-entrypoint.sh: line 14: can't create /app/data/.db.lock: Permission denied
3 Replies
5 months ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open brody • 5 months ago
5 months ago
You should check disk ownership and user permissions for modification.
docker exec -it <container_name> id
Make sure your volume has correct permissions, for example:
chmod 755 <path>
In your compose file make sure user is listed with your volumes:services:
your-service:
image: your-image
user: "1000:1000" # or whatever uid:gid your host uses
volumes:
- ./data:/app/data
Hope this helps
patrikhorvatic
You should check disk ownership and user permissions for modification.docker exec -it <container_name> idMake sure your volume has correct permissions, for example:chmod 755 <path>In your compose file make sure user is listed with your volumes:services: your-service: image: your-image user: "1000:1000" # or whatever uid:gid your host uses volumes: - ./data:/app/dataHope this helps
5 months ago
Am I able to run some commands to the hosted container on railway? Or you are talking about local development? in the local machine I have not met with this issue.
5 months ago
Railway doesn't support running commands inside hosted containers, so you’ll need to fix permissions during build. Add this to your Dockerfile:
RUN chown -R 1000:1000 /app/data
And in your docker-compose.yml, set:
user: "1000:1000"
This ensures your app has write access to the volume when deployed.
Status changed to Solved vanyagpt • 5 months ago
