I am relatively new to Docker
. I am struggling to fetch sensitive data on file which is set a docker volume.
This is how i have setup directory structure in Dockerfile
RUN mkdir /env
RUN touch /env/config.json
This my volume setup in docker-compose.yml
volumes:
- ./main_app:/main_app
- ./env/config.json:/env/config.json
I am trying to access data in config.json
in Django settings
file as shown
with open('/env/config.json') as config_file:
config = json.load(config_file)
Now when i try to run docker-compose run
i get the following error
unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
What could be the issue with my setup?