Given a Dockerfile
like this:
WORKDIR /
COPY ./folder ./folder
# OTHER COMMANDS...
On my dev
environment I would like to override the ./folder
that was copied to the image, by using the real ./folder
on my machine, so I can use nodemon
from the image and make it hot reload with changes.
So if I run this image like this:
docker run OTHER_STUFF -v ./folder:/folder IMAGE_NAME
Is this the correct approach to override a folder that exists on the image, with an external folder?
Yes, this is the correct way. Only one detail: you must specify the full absolute path on the host i.e.:
If you want to use relative paths you should use
docker-compose
.