My docker-compose file is as follows:
version: "3"
services:
db:
image: postgres
environment:
POSTGRES_PASSWORD: qwerty
POSTGRES_USER: qwerty
volumes:
- /data/db:/var/lib/postgresql/data
backend:
build:
context: .
dockerfile: dockerfile_backend
image: backend:dev1.0.0
entrypoint: ["sh", "-c"]
command: python manage.py runserver
ports:
- "4000:4000"
In my dockerfile_backend i have a git clone statement which clones the project from a git repo. There is a folder called configs which comes as a part of git clone. I need to mount this folder as volume(similar to postgres volume mount point). Mounting of configs is necessary because during runtime the content of the folder gets modified or updated,these changes should not be lost.
How can i mount the folder that image build creates ?
I have tried adding a volumes as follows under the backend service :
volumes:
- /data/configs:/git_folder/configs
Here the problem is mount point(/data/configs) is empty initially so the image folder(/git_folder/configs) also gets empty.