Open T-6 opened 1 year ago
You have to specify full name of environment variable:
services:
planningpoker:
environment:
- PlanningPoker__RepositoryForlder: /planningpoker
Btw, when you specify repository like this, probably it would fail, because /planningpoker
directory does not exist in the container. Also there is no need to store data in the container.
The goal of repository was to store data outside of the container, so that when the container is restarted, the data are not lost. For that you would need to define a volume, map it in the container and use that for repository.
I found this that describes how to define volumes in docker compose: https://github.com/compose-spec/compose-spec/blob/master/spec.md
Thanks for your answer. I use several container with bind mounts (volumes). In which file / folder are the data stored that should be stored between restarts? Then I can bind mount this folder to a folder on the host. Thanks
It would be the same folder that you configure in the environment variable. For example:
services:
planningpoker:
environment:
- PlanningPoker__RepositoryForlder: /planningpoker
volumes:
- /host/planningpoker/data:/planningpoker
/host/planningpoker/data
should be directory. Then each team is stored as separate file there.
This is my compose file:
services:
planningpoker:
image: duracellko/planningpoker
container_name: planningpoker
network_mode: host
environment:
PlanningPoker__RepositoryFolder: /planningpoker
volumes:
- /planningpoker:/planningboker
restart: unless-stopped
When trying to change the deck to Fibonacci sequence, I get this:
fail: Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher[8]
Failed to invoke hub method 'GetMessages'.
System.UnauthorizedAccessException: Access to the path '/planningpoker' is denied.
---> System.IO.IOException: Permission denied
The application inside docker runs under special app
user. I assumer that the directory /planningpoker
in the host was created by you and only you have access there. But not the app
user.
Simple solution is to make the directory public:
chmod -R o=rw /planningpoker
Better option is to setup access explicitly to the app user. At first you have to find user-id. You would need run id
command in the existing container: docker exec planningpoker id
Then you can set the user to be the owner of the /planningpoker
directory.
chmod -R u=rw /planningpoker && chown -R {user id from the container} /planningpoker
Usually I do not create directories which I use for bind mounts, but let docker-compose create them. As the container is running as root, the directory was created with root:root. The user app has id 1000. So I changed ownership of the directory to 1000:root and 1000:1000. But no success. I get still the same error message.
And it seems, I cannot run the container as another user like I do for others.
I didn't even know, that docker-compose creates directories for volumes. Mu suggested next steps for investigation:
Could you give me a hint how to do it correctly?
My docker-compose:
Thanks a lot for your support!!!