The following is my docker file
FROM node:16-alpine
WORKDIR /app
COPY a.txt /app
I have volume name my-volume which have a folder called dist. Im trying to mount my-volume to /app in the container. I use the below command.
docker run -v my-volume:/app -itd -e SERVICE_ENV='test01' 8ef983161140
The volume is getting mounted properly, but the issue is that the a.txt file in the container is getting replaced by dist folder from volume. I want to merge the contents of volume and container in /app.
Any idea?
docker run -v my-volume:/app -itd -e SERVICE_ENV='test01' 8ef983161140
expecting
/app # ls -al
total 0
drwxr-xr-x 3 root root 18 Oct 18 15:33 .
drwxr-xr-x 1 root root 18 Oct 18 16:22 ..
drwxr-xr-x 1 root root 18 Oct 18 16:22 a.txt
drwxrwxr-x 3 node node 18 Oct 18 14:11 dist
If you can't place
a.txtinmy-volume, you could placea.txtin/app_tmpin the image and have a script running on startup (e.g. withENTRYPOINT) that copies the file from/app_tmpto/app(that is the mountedmy-volume).