By Hemanta Sundaray on 2022-07-11
In development, whenever you make some changes in your web files, you would want the changes to reflect immediately in the browser without having to rebuild the image and restart the container.
You can achieve this by mapping your current directory with the working directory inside the container, with the help of Docker volumes.
All you need to do is to add the line as highlighted in the code snippet below while running your container.
docker run -d --name web-app \
-v $(pwd):/app \
-p 8000:8000 \
app-iamge
This way, the container will always contain the latest changes that you make to your source code, without the need to rebuild the image and rerun the container after every change.