I want to get a copy of my entire container using SSH. When I tried to get a list of container folders, here is the result. That’s perfect.
After that, I tried to execute the command
docker cp myContainerName:/resources D:\dockerBackup
I got “copying between containers is not supported” error every single time.
I try to change the directory, change C to D my local, add " " symbols, stoping the container… Anything doesn’t help me read on the internet.
I just want to get a backup of my all folders. That is.
Is there anyone here who can help me?
When you use SSH, you are usually in a shell on a Linux server or Linux VM. There your local Windows folder is probably not known.
Correct, I forget it. So should I connect to docker server from my windows CLI?
The syntax of docker cp
is
docker cp container:/path localpath
or
docker cp localpath container:/path
So D:\dockerBackup
means \dockerBackup
in container D. I don’t know if it is syntactically correct on Windows as I rarely use Docker on it, but if it is, and you have an SSH docker context, you can try that. to be honest I’m confused. I don’t know how SSH is relevant here. If you SSH-d into a remote server, why would you try to copy directly to your local Windows machine? You could copy the file out from the container and save it on the Linux host, and after that use scp
on Windows to copy the file from the remote server to your Windows.
If the Linux host is a WSL distro on Windows, then you can copy files directly to the Windows filesystem, but I don’t remember the exact folder structure. It is something like /mnt/d/dockerBackup
.
Alternatively, you can export the entire filesystem of the container like this:
docker export myContainerName -o out.tar
extract the tar
mkdir out
cd out
tar -xf ../out.tar
And use the standard cp command to copy the files on the Linux filesystem, or from a remote Linux server copy the files using scp on Windows.