Closed amitash closed 2 days ago
Same error for me loading a picture.
I had to change the permissions of the storage
directory to be owned by my user rather than root
using sudo chown user:user storage
and chmod +rw storage
.
Can someone confirm if adding the following to your Docker compose file solves the issue?
diff --git a/docker-compose.example.yml b/docker-compose.example.yml
index cbd5232..9b0fa88 100644
--- a/docker-compose.example.yml
+++ b/docker-compose.example.yml
@@ -37,6 +37,9 @@ services:
ports:
- 3000:3000
+ command: >
+ sh -c "chown -R rails:rails /rails/storage && ./bin/rails server"
+
restart: unless-stopped
environment:
sh -c "chown -R rails:rails /rails/storage && ./bin/rails server"
With this, the container fails to start with the following error.
chown: changing ownership of '/rails/storage': Operation not permitted
This probably needs to be done as sudo
from the Dockerfile.
I think it would be better if it was added to the Dockerfile
instead of a Compose command.
If the USER
command is moved above this RUN
command, would that fix the problem?
https://github.com/maybe-finance/maybe/blob/0593d8fb7e586ddd9bfe396c000a48bfd6451304/Dockerfile#L53-L57
@amitash thanks for confirming! Could you try the solution I've posted below?
@hkamran80 I'm thinking that instead of altering the Dockerfile, we may be better off just using a named volume rather than a bind mount (which is dependent on the host machine's directory structure/permissions):
diff --git a/docker-compose.example.yml b/docker-compose.example.yml
index cbd5232..ad5220b 100644
--- a/docker-compose.example.yml
+++ b/docker-compose.example.yml
@@ -32,7 +32,7 @@ services:
image: ghcr.io/maybe-finance/maybe:latest
volumes:
- - ./storage:/rails/storage
+ - app-storage:/rails/storage
ports:
- 3000:3000
@@ -70,4 +70,5 @@ services:
retries: 5
volumes:
+ app-storage:
postgres-data:
@zachgoll That's a good idea. That should fix the issues.
@zachgoll indeed, it fixes the issue.
@amitash going to reopen this mainly as a reminder so I remember to update the docker-compose.example.yml
file with this new config
Describe the bug
Using latest docker guide from https://github.com/maybe-finance/maybe/blob/main/docs/hosting/docker.md
To Reproduce Steps to reproduce the behavior:
Account
Choose
button to select a picture to uploaddocker container logs maybe -f
Expected behavior Picture should upload successfully
Additional context This also happens when uploading picture for financial institution.