Machine: windows7 sp1 > docker-machine scp doesn't work: exit status 1 (usage)

Created on 3 Nov 2017  路  15Comments  路  Source: docker/machine

Hi
I'm trying to do some basics: scp a given file onto a fresh new docker instance.

I don't understand what's wrong. I'm under windows 7 SP1 / windows git bash.
(I was trying the same under cmd.exe with same result)

Here is the step to reproduce for me using git bash:

````bash

$ export PATH=/c/Programmes/DockerToolbox/:/c/Programmes/Git/bin/:/c/Programmes/Git/usr/bin/

$ git --version
git version 2.15.0.windows.1

$ docker-machine version
docker-machine.exe version 0.13.0, build 9ba6da9

$ /c/Programmes/VirtualBox/VBoxManage.exe --version
5.2.0r118431

$ cd /c/tempo

$ docker-machine create default

it works!

(...)

Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: C:\Programmes\DockerToolbox\docker-machine.exe env default

$ docker-machine.exe ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default - virtualbox Running tcp://192.168.99.100:2376 v17.10.0-ce

$ eval "$(docker-machine env default)"

$ docker-machine.exe ssh default

it works!

$ echo SimpleFile > myFile

$ docker-machine scp myFile default:
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
````

What is really confusing is that when I'm doing the same stuff with debug mode, docker-machine is providing the command used. And this one works!

````bash
$ docker-machine --debug scp myFile default:
Docker Machine Version: 0.13.0, build 9ba6da9
Found binary path at C:\Programmes\DockerToolbox\docker-machine.exe
Launching plugin server for driver virtualbox
Plugin server listening at address 127.0.0.1:59450
() Calling .GetVersion
Using API Version 1
() Calling .SetConfigRaw
() Calling .GetMachineName
(default) Calling .GetSSHPort
(default) Calling .GetSSHKeyPath
(default) Calling .GetSSHKeyPath
(default) Calling .GetSSHKeyPath
(default) Calling .GetSSHHostname
(default) Calling .GetSSHUsername
{C:\Programmes\Git\usr\bin\scp.exe [C:\Programmes\Git\usr\bin\scp.exe -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -3 -o IdentitiesOnly=yes -o Port=59393 -o IdentityFile="C:\Users\myuserhere\.docker\machine\machines\default\id_rsa" myFile [email protected]:] [] [] false [] [] [] [] }
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

$ C:\Programmes\Git\usr\bin\scp.exe -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -3 -o IdentitiesOnly=yes -o Port=59393 -o IdentityFile="C:\Users\myuserhere\.docker\machine\machines\default\id_rsa" myFile [email protected]:
myFile 100% 11 6.3KB/s 00:00

it works!

````

The only diff is the "\" in the binary path ("\\" expected)

After reading some close issue, I got same status with the following attempt:
````
$ MYSYS_NO_PATHCONV=1 docker-machine scp localhost:./myFile default:/home/docker
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

````

do you know how to fix that ?

Most helpful comment

thanks @matt9ucci
another people met the same issue with 0.13.0. Seems to be related to this version. I confirm that older version doesn't produce this error.

All 15 comments

Here is a workaround I'm using:

````bash
MACHINE=default

echo "Loading env for $MACHINE docker machine"
eval $(docker-machine env $MACHINE) || (echo "Unable to set machine $MACHINE env" && exit 1)

function alternate_scp {
echo "Hum... seems 'docker-machine scp' doesn't work, try alternate way.."
# retrieve docker default machine SSH PORT
# cat ~/.docker/machine/machines/default/default/default.vbox|grep Forwarding
# using grep regexp to isolate forwarded port number only
SSHPORT=cat ~/.docker/machine/machines/$MACHINE/$MACHINE/$MACHINE.vbox|grep Forwarding| grep -oP "hostport=\"\K\d+"
echo " - retrieved ssh forwarded port: $SSHPORT"
# using generated pk
SSHIDFILE=~/.docker/machine/machines/$MACHINE/id_rsa
echo " - using identity: $SSHIDFILE"

SSHOPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -3 -o IdentitiesOnly=yes "
scp.exe $SSHOPTS -o Port=$SSHPORT -o IdentityFile="$SSHIDFILE" -r resources [email protected]: || (echo "Unable to scp machine $MACHINE" && exit 1)

}

echo "Copy resources"
docker-machine scp -r resources $MACHINE: || alternate_scp
````

@boly38 I met the same issue on Windows 10. It might be related to #4261. When using v0.12.2, docker-machine scp myFile default: works fine.

thanks @matt9ucci
another people met the same issue with 0.13.0. Seems to be related to this version. I confirm that older version doesn't produce this error.

This is a major regression -- no one looking at this?

yeah, I can confirm that on docker-machine.exe version 0.13.0, build 9ba6da9 going to the linux docker-host via git bash on a windows 10 machine, that scp is not working and returns "exit status 1"

if I run the debug command directly, taking out the space from the scp pathing and only run scp.exe blah blah blah, it works.

I have the same issue, I have even tried to install older Docker Toolbox version (the one that should come with docker-machine 0.12.2) but it seems that it somehow installs newest docker-machine 0.13.0

Please fix this!

@pidzama If you run it with a --debug, it will give you the eventual call that it's trying to make to the machine. Run THAT on a command line (minus the full path to scp) and the command itself worked for me.

I've ran into this same issue, though it doesn't seem to matter if there is spacing in the path to scp.exe. I installed Git with no spacing in the install path and still ran into this issue.

Running the call copied from --debug works as stated above.

Win 10, docker-machine 0.13.0, Git 2.16.0.2x64

Friendly bump for this issue. Upgraded from 17.09 to 17.12 (Windows 10 Professional) and ran into this problem. Worked before.

Using Git Bash:

$ docker-machine --version
docker-machine.exe version 0.13.0, build 9ba6da9
$ docker-machine create --driver virtualbox --virtualbox-hostonly-cidr 192.168.99.99/24 --virtualbox-cpu-count 1 --virtualbox-memory 1024 --virtualbox-no-share docker-vm
$ docker-machine scp foo.txt docker-vm:/home/docker/foo.txt
usage: scp [-12346BCpqrv] [-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

Uninstalling Docker, (re-)installing 17.09

$ docker-machine --version
docker-machine.exe version 0.12.2, build 9371605
$ docker-machine create --driver virtualbox --virtualbox-hostonly-cidr 192.168.99.99/24 --virtualbox-cpu-count 1 --virtualbox-memory 1024 --virtualbox-no-share docker-vm
$ docker-machine scp foo.txt docker-vm:/home/docker/foo.txt
foo.txt (100% progressbar)

Sadface.

Just installed the latest version of Docker Toolbox and ran in to the same proble.
Doing a --debug will give me the right command to call.

We use docker-machine scp as a step in our automated developer setup, and this will not work until this bug is fixed.

@thaJeztah Anyone available to get attention on this regression?

@bechhansen here is a workaround: https://github.com/docker/machine/issues/4302#issuecomment-341727432

we implemented this in our local build environment. might (or might not) work for you as well.

ping @shin-

I'm guessing this is somehow related to golang/go#17149 but it's quite mysterious that using the exact command present in the debug output works when pasted directly into the shell.

See https://github.com/docker/machine/pull/4388, this will now be fixed in 0.14.0

Was this page helpful?
0 / 5 - 0 ratings