I want to access some files kept on the host from the docker container.
Edit-
My use case:
What I've done:
executed the following command to copy the contents of the host folder to the container's folder
docker run -d --volume C:\host_folder:/conf/container/tmp d9746fe0b603 sleep infinity
Upon executing the followng command - docker exec -it cd8ca46e46c6 sh
I am able to check that contents of the C:\host_folder
are copied to the /conf/container/tmp
folder in the container. Attached Screenshots.
But when I am running the application in the container,
getting the same error - the service can't find the file stored on the host system.
Attaching a few screenshots-
I tried restarting and rebuilding the container using - docker-compose up --build
but that's not working. Can anybody tell me what's the issue and how I can fix that. TIA
Problem with the approach that I have discussed under What I've done in the description:
docker-compose up --build
, the updates were getting lost. (Because the commands were run on a console, may be!)Solution that finally worked for the discussed case -
In the docker-compose file, inside the image, under the volumes tag mention the folders that you want to mount, like given below:
application-mage:
.
.
volumes:
- C:/host_folder/:/conf/container_folder/tmp/