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

2

35

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
Galvano answered 12/8, 2017 at 20:18 Comment(4)
So does this thing work in Windows 2016?Galata
Error was descriptive. Since you run it on Windows 10 you can not run in any other isolation other then Hyper-V. If you deploy it on Windows 2016 then you can run it in process isolation and will not have this issue.Halliday
Thanks @GregorySuvalian ... I was able to get around the issue by stopping the container, running the docker cp command and then restarting the container. It is relatively just an inconvenience, but I was able to get past the issue when I looked at the error again closely.Galvano
I would recommend using scp to copy between host and containerItself
G
41

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

Galvano answered 12/8, 2017 at 21:40 Comment(1)
For people wanting to mount the host folder into the container, it worked for me to add this to my docker run command: --mount type=bind,source="c:/host/folder/path/with/forward/slashes",target="C:/container/folder/path/with/forward/slashes".Warden
U
4

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

Uttermost answered 19/4, 2020 at 19:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.