Docker cp command not allowed

As the other answer stated, it's because it thinks the c: is a container name. You can solve this by wrapping the path in quotes like docker cp my_container:/folder "c:\anotherfolder"


I think it's because docker thinks c is container name. You can use relative path rather than absolute path.

So if you are in C:/ you can just:

docker cp my_container:/folder anotherfolder

Also notice that there are few differences between running commands in window's cmd and in git bash.

1. You are using git bash:

Or escape in git bash console on windows:

WlaDo@DESKTOP-RBBRJOD MINGW64 ~
$ docker cp eb19fc21889c:/data c:\test
copying between containers is not supported <--- we got this error which points to implementation for which I added link below

WlaDo@DESKTOP-RBBRJOD MINGW64 ~
$ docker cp eb19fc21889c:/data c:\\test
<--- no errors here -->

WlaDo@DESKTOP-RBBRJOD MINGW64 ~
$ ls c:\\test
<--- data from container -->

2. You are using windows cmd

From windows cmd the approach you have should work:

C:\Users\WlaDo>docker cp eb19fc21889c:/data c:\test
<--- no errors here -->

C:\Users\WlaDo> dir  c:\test
<--- data from container -->

Copying between containers is not implemented and throws the error.

For more info check documentation about docker cp

A colon (:) is used as a delimiter between CONTAINER and its path. You can also use : when specifying paths to a SRC_PATH or DEST_PATH on a local machine, for example file:name.txt. If you use a : in a local machine path, you must be explicit with a relative or absolute path, for example:

`/path/to/file:name.txt` or `./file:name.txt`

Tags:

Docker