I m not very clear on this topic and I keep finding myself having more doubts as I read.
I read that volume mounts cant share the same dir. (One gets overwritten). So I want to understand what happens when a container image is using same path (/etc/) as the one that is used as volume mount in pod also
Dockerfile
RUN mkdir /etc/app/
RUN mkdir /etc/config/
COPY app.yml /etc/app/app.jar → has jar
COPY app.yml /etc/config/app.yml → has some static conf
deployment.yml
volumeMounts:
- name: config-volume
mountPath: /etc/config/ → used for configmap and has additional dynamic conf
in this case, what will happen. The sample app that I am using works. But how?
I want to have a clear understanding of this topic and any links with clear details will help me greatly.
Edit: is it working because I am not using volume in dockerfile? and the dir created in the image is just part of the one container where image is used? And so the container is also able to access volume as expected. So what happens if same file (/etc/config/app.yml) is created in image and in pod? What happens then?
I am sorry if my post is confusing and the format is wrong. I will correct it based on suggestions