Tuesday, 3 December 2019

Mount Volumes to Docker Containers On Windows 7



                                                                                           



We need to perform the below steps to mount volumes on Docker in Windows 7

1) Stop the Docker machine using the below Command
"docker-machine stop"

2) Add the Virtual Box Installation Directory to the PATH variable
"C:\Program Files\Oracle\VirtualBox"

3) Then Share the Folder to be mounted using the below command
vboxmanage sharedfolder add default --name "FolderName" --hostpath "Folder Full Path" --automount
ex: vboxmanage sharedfolder add default --name "MountedVolumes" --hostpath "C:\DockerFS\Volumes" --automount

4) Start the Docker-Machine using the below Command
"docker-machine start"

5) Run the Container by using -v flag to mount the folder,
"docker container run -itd -v /FolderName:/app fs"
ex: docker container run -itd -p 5000:5000 --rm --name fs -e FLASK_APP=app.py --net fsnetwork -v /MountedVolumes:/app fs

No comments:

Post a Comment