The Problem: can’t generate/create files on mounted volumes in docker that is not own by root. Throwing permission denied errors when I create and push my user to docker-compose as well.
version: '3.4' services: app: image: ubuntu:latest command: /home/john/clone_repository_and_generate_reports.sh volumes: - "/home/john/:/home/john/" environment: - NODE_ENV=production env_file: - ./.config.env
docker-compose.ymlfile calls to simple bash script that clones a github repository and generate different reports in python, In addition I want this data to be accessible and persistent to user
john, unfortunately the the saved files are on
If Im adding on Dockerfile additional user
RUN addgroup -S developer && adduser -S john -G developerIt gets permissions issue accessing to this mounted volume
USER=$(id -u):$(id -g) docker-compose up --build --force-recreate -d
Expected behaviour: cloned github repository and generated files owned by
john and not by
What is the right approach dealing with permission issue on docker?
How can I save these files under
john user on this mounted volume?
Source: Docker Questions