Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to copy to Windows container ('docker cp') on Windows 10

I set up Docker for Windows on my laptop and switched from Linux Containers to Windows Containers in Docker's settings (which prompted a couple of restarts and Windows updates). I pulled an image and ran a container based on it using the commands:

docker pull microsoft/dotnet-framework docker run -it microsoft/dotnet-framework cmd 

In a second terminal window, I executed the command:

docker cp app container_id:/ 

and received this error message:

Error response from daemon: filesystem operations against a running Hyper-V container are not supported

I googled this error, but nothing (explanatory) came up, quite surprisingly. Is there a way I can run the image as a Windows container rather than a Hyper-V container, on Windows 10?

Ultimately, I will deploy this container to a Windows Server 2016 host, but I need to do all development and testing in my laptop running Windows 10 Pro.

Docker Version

Client:  Version:      17.06.0-ce  API version:  1.30  Go version:   go1.8.3  Git commit:   02c1d87  Built:        Fri Jun 23 21:30:30 2017  OS/Arch:      windows/amd64  Server:  Version:      17.06.0-ce  API version:  1.30 (minimum version 1.24)  Go version:   go1.8.3  Git commit:   02c1d87  Built:        Fri Jun 23 22:19:00 2017  OS/Arch:      windows/amd64  Experimental: true 
like image 518
Web User Avatar asked Aug 12 '17 20:08

Web User


People also ask

How do I copy a file into a docker container?

Another way to copy files to and from Docker containers is to use a volume mount. This means we make a directory from the host system available inside the container. The command above runs a grafana container and mounts the /tmp directory from the host machine as a new directory inside the container named /transfer.

How do I copy a folder using Docker cp?

If you want to copy the /tmp/foo directory from a container to the existing /tmp directory on your host. If you run docker cp in your (home) directory on the local host: $ docker cp compassionate_darwin:tmp/foo /tmp Docker creates a /tmp/foo directory on your host.


2 Answers

Based on a comment by @GregorySuvalian, I understand that Windows 10 allows Hyper-V runtime only. So my workaround is to stop the container, running the docker cp command and restart the container. (I preferred this over setting up a volume, since it is just a one time operation.)

like image 61
Web User Avatar answered Sep 17 '22 13:09

Web User


Edit to Vimes answer as I had a difficult time to use the --mount within my docker run commmand. The actual run command needs to be within the quotes '' starting from type...

--mount 'type=bind,source="c:/host/folder/path/with/forward/slashes",target="C:/container/folder/path/with/forward/slashes"'

like image 39
Go Potiya Avatar answered Sep 19 '22 13:09

Go Potiya