Home > other >  Not allowed to use Docker cp command
Not allowed to use Docker cp command

Time:09-26

I am trying to use this command to copy a file from a container to my host Windows machine

Docker cp my_container:/folder c: \ anotherfolder

Docker console return

Copying between containers is not supported

Why is that?
Customer: version: 17.05.0 - ce API version: go to version 1.29: go1.7.5 Git commit: 89658 be built: on Friday May 5, 2017 15:36:11 OS/Arch: Windows/amd64
Server: version: 17.05.0 - ce API version: version 1.29 (version 1.12) to: go1.7.5 Git commit: 89658 be built: on May 4, 2017, Thursday 21:43:09 OS/Arch: Linux/amd64 experiment: false

CodePudding user response:

I think this is because the docker think c is container name. You can use the relative path rather than an absolute path.
So, if you are in the C:/you can:

Docker cp my_container:/folder anotherfolder

Also note that in the CMD window and git bash almost no difference between running commands.
1. You are using git bash:
To the console or on Windows git bash escape:

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

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

WlaDo @ DESKTOP - RBBRJOD MINGW64 ~
$ls c: \ \ test
<- the data from the container - & gt;

2. You are using Windows CMD
From Windows CMD you should some methods:

C: \ Users \ WlaDo> Docker cp eb19fc21889c:/data c: \ test
<- no errors here - & gt;

C: \ Users \ WlaDo> Dir c: \ test
<- the data from the container - & gt;

The container is not implemented between copy and throw an error.
About the docker cp for more information, please check the document


A colon (:) is 2 as A delimiter between the CONTAINER and its path. You
Can also use: when specifying paths to a SRC_PATH or DEST_PATH on a
The local machine, for example file: name. TXT. If you use a: in a local
The machine path, you must be explicit with a relative or absolute path,
For example:
`/path/to/file: name. TXT ` or `./file: name. TXT `

CodePudding user response:

Docker cp version 1.7 shall not apply to the need to upgrade to version 1.8 and above
  • Related