Unable to copy to Windows container ('docker c

2020-08-09 08:22发布

问题:

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

回答1:

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.)



回答2:

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"'