34

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
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Web User
  • 7,438
  • 14
  • 64
  • 92
  • So does this thing work in Windows 2016? – Tarun Lalwani Aug 12 '17 at 21:29
  • 2
    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. – Gregory Suvalian Aug 12 '17 at 21:35
  • 2
    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. – Web User Aug 12 '17 at 21:37
  • I would recommend using scp to copy between host and container – Summer Sun Aug 02 '22 at 07:01

2 Answers2

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

Web User
  • 7,438
  • 14
  • 64
  • 92
  • 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"`. – Vimes Jan 30 '19 at 20:19
  • if you stop the container, what do you copy to? there is no container id anymore and when you start the container again you will get a fresh new instance with a different id – Mehdi Aug 29 '23 at 14:09
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"'

Go Potiya
  • 67
  • 4