Open robvelor opened 8 years ago
Probably a colon :
present in Windows expanded paths like C:\Documents\myfile.txt
disturbs the scp clients, that expect a colon :
is used to separate host from path.
Yes, for scp
you are forced into Unix-style filepaths for the time being. Try using the Toolbox quickstart (or MYSYS_NO_PATHCONV=1
in Git for Windows) and using the Unix notation:
$ docker-machine scp /c/users/rob/myfile.txt local-swarm-node-1:/home/docker
Tried in git-bash and docker quickstart terminal - same error though
pradeep@seleniumframework ~
$ export MYSYS_NO_PATHCONV=1
pradeep@seleniumframework ~
$ docker-machine scp /c/Users/pradeep/.docker/machine/machines/default/ca.pem default:/home/docker/.docker/
Error loading host: Error loading host: Host does not exist: "C"
It looks a lot like it's still attempt path translation. Make sure you're using Git for Windows as it's only a specific version that supports MSYS_NO_PATHCONV
.
@nathanleclaire I was using another terminal when I reported this, let me test with the quickstart one and see.
Nope same error with the quickstart terminal and Unix notation.
$ docker-machine scp /c/Users/rvelasquez/myfile.txt local-swarm-node-1:~/
Error loading host: Error loading host: Host does not exist: "C"
I just tried this and it worked... localhost:/c/some-path
Need to specify in docs? @nathanleclaire
I just bumped into the same problem, and indeed the solution is to:
localhost:
at the beginning (there is some specific code in the go implementation around localhost:
)This makes it hard to script docker-machine
from the outside. I've just put in a fix for machinery around this. What I do is to call mount
(which exists in most NIX-like environments on Windows) to list out where c:
(or whichever the windows drive letter was) is mounted onto the shell file system. I then cache this for the life-time of the program. It works, but it's kind of clumsy.
Maybe should this (or similar) be done in docker-machine
instead. Note that the scp.go
implementation workaround using localhost:
will have to be modded as it does a split on :
, which obviously isn't doing a proper job when the file path contains a :
itself. What do you think @nathanleclaire ?
Dears ,please let me know what to do!! I am not able to copy from my local windows8 machine to the remote ubuntu machine I am using GITbash..The below is sample from my Gitbash output
Maha.Sallam@Maha MINGW64 ~/.ssh $ MYSYS_NO_PATHCONV=1
Maha.Sallam@Maha MINGW64 ~/.ssh $ docker-machine scp -r /C/Users/Maha.Sallam/.ssh default:~/.ssh Error loading host: Error loading host: Host does not exist: "C"
Maha.Sallam@Maha MINGW64 ~/.ssh $ docker-machine scp -r ~/.ssh default:~/.ssh Error loading host: Error loading host: Host does not exist: "C"
Maha.Sallam@Maha MINGW64 ~/.ssh $ docker-machine scp -r localhost:/C/Users/Maha.Sallam/.ssh default:~/.ssh id_rsa 100% 1675 428.6KB/s 00:00 id_rsa.pub 100% 398 128.1KB/s 00:00
@nathanleclaire please advise ..
I don't understand, @Mhussein27 the last line in your output examples seems to have performed well?
We couldn't get it working even with localhost:
prepended, but there's a quick workaround with cat if you want to transfer just one file:
docker-machine ssh machine_name "cat > /destination/file" < /c/source/path/file
and to add another weird version of the problem to the stack:
$ docker-machine -D scp gitlab:~/test .
Docker Machine Version: 0.13.0, build 9ba6da9
Found binary path at C:\Program Files\Docker\Docker\Resources\bin\docker-machine.exe
Launching plugin server for driver openstack
Plugin server listening at address 127.0.0.1:64527
() Calling .GetVersion
Using API Version 1
() Calling .SetConfigRaw
() Calling .GetMachineName
(sima-gitlab) Calling .GetSSHPort
(sima-gitlab) Calling .GetSSHKeyPath
(sima-gitlab) Calling .GetSSHKeyPath
(sima-gitlab) Calling .GetSSHKeyPath
(sima-gitlab) Calling .GetSSHHostname
(sima-gitlab) Calling .GetSSHUsername
{C:\Program Files\Git\usr\bin\scp.exe [C:\Program Files\Git\usr\bin\scp.exe -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -3 -o IdentitiesOnly=yes -o Port=22 -o IdentityFile="C:\\Users\\dow184\\.docker\\machine\\machines\\gitlab\\id_rsa" debian@43.240.97.7:~/test .] [] <nil> <nil> <nil> [] <nil> <nil> <nil> <nil> <nil> false [] [] [] [] <nil> <nil>}
usage: scp [-346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[-l limit] [-o ssh_option] [-P port] [-S program]
[[user@]host1:]file1 ... [[user@]host2:]file2
exit status 1
dow184@TOWER-SL MINGW64 ~/src/deployment (master)
$ uname -a
MINGW64_NT-10.0 TOWER-SL 2.9.0(0.318/5/3) 2018-01-12 23:37 x86_64 Msys
dow184@TOWER-SL MINGW64 ~/src/deployment (master)
$ scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -3 -o IdentitiesOnly=yes -o Port=22 -o IdentityFile="C:\\Users\\dow184\\.docker\\machine\\machines\\gitlab\\id_rsa" debian@43.240.97.7:~/test .
test
I faced same problem. (windows10 home, docker toolbox)
I tried to test scp
command, but it failed.
$ docker version
Client:
Version: 18.02.0-ce
API version: 1.35 (downgraded from 1.36)
Go version: go1.9.4
Git commit: fc4de447b5
Built: Mon Feb 12 19:03:38 2018
OS/Arch: windows/amd64
Experimental: false
Orchestrator: swarm
Server:
Engine:
Version: 17.12.1-ce
API version: 1.35 (minimum version 1.12)
Go version: go1.9.4
Git commit: 7390fc6
Built: Tue Feb 27 22:20:43 2018
OS/Arch: linux/amd64
Experimental: false
$ pwd
/c/Users/Jungho/dockerws
$ ls -al
total 30
drwxr-xr-x 1 Jungho 197121 0 3월 12 21:46 ./
drwxr-xr-x 1 Jungho 197121 0 3월 12 21:42 ../
-rw-r--r-- 1 Jungho 197121 390 3월 12 21:17 docker.cow
-rw-r--r-- 1 Jungho 197121 511 3월 12 21:34 Dockerfile
-rw-r--r-- 1 Jungho 197121 569 3월 12 22:00 nginx.conf
-rw-r--r-- 1 Jungho 197121 2723 3월 12 21:46 nginx.conf.invalid
$ docker-machine scp /c/Users/Jungho/dockerws/nginx.conf default:/home/docker
Error loading host: Error loading host: Docker machine "C" does not exist. Use "docker-machine ls" to list machines. Use "docker-machine create" to add a new one.
How should I get solved??
@SvenDowideit Your log shows that Machine is passing C:\Program Files\Git\usr\bin\scp.exe
as the first argument to scp
. I see the same, and confirmed it with Process Monitor:
$ docker-machine --version
docker-machine.exe version 0.14.0, build 89b8332
This happens with and without localhost:
.
Same problem. Windows 10 using docker quick start terminal
Jason@Forge MINGW64 /d/Minikube/code
$ docker-machine --version
docker-machine.exe version 0.14.0, build 89b8332
$ docker-machine scp docker-media:/home/docker/plexserver.log localhost:/d/Minikube/.
cp: cannot stat 'Files\Git\usr\bin\scp.exe': No such file or directory
ssh: Could not resolve hostname c: Name or service not known
cp: cannot stat 'Files\Git\usr\bin\scp.exe': No such file or directory
cp: cannot stat '-o': No such file or directory
cp: cannot stat 'StrictHostKeyChecking=no': No such file or directory
cp: cannot stat '-o': No such file or directory
cp: cannot stat 'UserKnownHostsFile=/dev/null': No such file or directory
cp: cannot stat '-o': No such file or directory
cp: cannot stat 'LogLevel=quiet': No such file or directory
cp: cannot stat '-3': No such file or directory
cp: cannot stat '-o': No such file or directory
cp: cannot stat 'IdentitiesOnly=yes': No such file or directory
cp: cannot stat '-o': No such file or directory
cp: cannot stat 'Port=63735': No such file or directory
cp: cannot stat '-o': No such file or directory
ssh: Could not resolve hostname identityfile=d: Name or service not known
ssh: connect to host 127.0.0.1 port 22: Connection refused
exit status 1
Over a year later this is still broken today.
Well, as nobody seems to be putting some effort into docker-machine, this is not likely to be fixed any time soon.
Still broken as of version 0.16.1, build cce350d7.
However, a kludge of a workaround:
dm -D scp app.jar docker@default:/home/docker/app.jar
...
{C:\cygwin64\bin\scp.exe [C:\cygwin64\bin\scp.exe -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -3 -o IdentitiesOnly=yes -o Port=55718 -o IdentityFile="C:\\Users\\.docker\\machine\\machines\\default\\id_rsa" app.jar docker@127.0.0.1:/home/docker/app.jar] [] <nil> <nil> <nil> [] <nil> <nil> <nil> <nil> <nil> false [] [] [] [] <nil> <nil>}
ssh: Could not resolve hostname c: Name or service not known
...
Copy the command inside of the square brackets, then paste it to your command-line and run. This works in cygwin's terminal window (if you replace all that silly backslash stuff in the scp.exe command with simply scp). I can't vouch for other terminals/setups.
There is obviously quite a bit of confusion as to how to make this work properly. Since I don't know Go, I don't have much to contribute other than this interim solution.
As a workaround, you can run a scp command and provide the Docker machine's ip and private key, like so:
MYSYS_NO_PATHCONV=1 scp -i $MACHINE_STORAGE_PATH/machines/$DOCKER_MACHINE_NAME/id_rsa \
root@$(docker-machine ip $DOCKER_MACHINE_NAME):/tmp/my-backup.zip \
/S/data/backup/backup_$(date +%Y%m%d_%H%M%S).zip
Works using git bash's scp command.
If you want to cope files from container to local (in Windows), you can
Hi guys, I'm facing an issue running the scp command on docker machine for windows.
Machine version (Windows 7):
Command:
My guess is machine thinks the path /c/ is a machine instead of a path on the host machine. Is this supported on windows?
Are only relative paths supported on windows?