Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'docker -v' bind mount is not working any more on Windows 10

When I first started playing with Docker on Windows 10 it all worked great. I could bind mount a local directory and mess around interactively with things like this:

docker run -it -v ${PWD}:/app -w /app ubuntu:trusty /bin/bash

Which should copy the contents from the current directory on my local machine into the container then start me into an interactive Bash shell where I can see them with ls, execute them, etc.

But now that I'm coming back to it after a month or so when I have a real project I want to solve with Docker, I can't repeat my earlier success.

Now when I run the above interactive command, the /app directory is created in the container, but doesn't have the files from my local disk in there. I tried some other non-interactive Docker commands that I'd been using, and they fail too, because they can't seem to see the files either.

PS C:\Users\xxx\app> docker run -v ${PWD}:/app -w /app ubuntu:trusty ./startup.sh
   C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"./startup.sh\": stat ./startup.sh: no such file or directory": unknown.
like image 934
Rian Sanderson Avatar asked Jul 01 '18 06:07

Rian Sanderson


People also ask

Why is Docker not working Windows 10?

Operating System. If you do not run a 64-bit version of Windows Windows 10 Pro, Enterprise, or Education; 1511 November update, Build 10586 or later, you cannot run Docker for Windows. You can install Docker Toolbox if you have a 64-bit version of Windows 7 or later. Alternately, you do have the option to upgrade.

How does bind mount work Docker?

Bind mounts have been around since the early days of Docker. Bind mounts have limited functionality compared to volumes. When you use a bind mount, a file or directory on the host machine is mounted into a container. The file or directory is referenced by its absolute path on the host machine.

What is the difference between Docker volume and bind mount?

The most notable difference between the two options is that --mount is more verbose and explicit, whereas -v is more of a shorthand for --mount . It combines all the options you pass to --mount into one field. On the surface, both commands create a PostgreSQL container and set a volume to persist data.


1 Answers

After several unsuccessful days of googling, I started digging through my notes and went through the same Docker tutorials I had used to get started.

It turns out the problem was that a few weeks ago I had changed my Windows password. The fix was to reset my credentials in the shared-drives tab of the Docker setting

Docker settings application with Reset Credentials link

They also had an example for a more concise test for if the -v command was working:

https://docs.docker.com/docker-for-windows/#shared-drives

like image 152
Rian Sanderson Avatar answered Oct 30 '22 20:10

Rian Sanderson