Hey guys,
I’ve been having a hard time finding a clear and concise guide for mounting volumes using Docker Toolbox.
I’m following the tutorial linked below, and because the tutorial user is working with Docker Desktop for Mac, I’m not having so much luck following along in Windows.
I’m stuck at the part where he’s mounting volumes.
I believe my syntax is correct after searching for other examples and the documentation.
docker container run -d -p 8080:80 -v /D:/Docker:/usr/share/nginx/html --name nginx-website nginx
I don’t know if I’m missing a step or two before this because I keep getting an error response from the daemon.
C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: invalid mode: /usr/share/nginx/html.
See 'C:\Program Files\Docker Toolbox\docker.exe run --help'.
I actually realize that the colon after C
was spliting the string up into another argument. I now tried the following and it seems to have worked.
//D/Docker:/user/share/nginx/html
But when I bash into it on the container, I don’t see any files written to it from the host and when I visit the page it’s gives back a 403 error.
Can I get some help on mounting a volume in Windows, please?
EDIT
Having problems syncing files in mounted volumes
How exactly does Docker Toolbox/VirtualBox treat mounted volumes? If I bash into a container and create a test file, then attempt to mount that directory containing the test file to a directory on my Windows host, wouldn’t I then be able to see the file? I tried such and it didn’t work.
I’m testing different file creation scenarios regarding volume mounting, because the files seen on the host and guest should be exactly the same no matter who mutates them. The Docker container doesn’t seem to be retaining any changes the Windows host makes to the shared directory.
I’ve hit another roadblock in the tutorial video where the instructor is then trying to build a Docker image out of the nginx container where a new index file was added from the host via mounting. The image doesn’t build correctly because the expected result is a page displaying “Hello World” when the newly built image is copied to a new container from the base nginx container where it was created, but is instead displaying the nginx welcome page.