在Windows上使用Vagrant的docker提供程序的Rsync“权限被拒绝”错误

刚从官网安装了vagrant 1.7.4,除了其他的软件:Virtual Box,Cygwin(rsync和openssh)。 像ubuntu / trusty或者centos / 7这样的其他软件似乎可以正常工作。 当我尝试使用docker作为提供程序时出现错误。 这是我的stream浪文件

Vagrant.configure(2) do |config| config.vm.network "public_network", ip: "192.168.1.103" config.ssh.insert_key=true config.vm.provider "docker" do |d| #d.vagrant_vagrantfile = "vagrantfile-boot2docker" d.build_dir = "." end ENV["VAGRANT_DETECTED_OS"] = ENV["VAGRANT_DETECTED_OS"].to_s + " cygwin" end 

这是在控制台中发生的事情。

 $ vagrant up Bringing machine 'default' up with 'docker' provider... ==> default: Docker host is required. One will be created if necessary... default: Docker host VM is already ready. ==> default: Syncing folders to the host VM... default: The machine you're rsyncing folders to is configured to use default: password-based authentication. Vagrant can't script rsync to automatically default: enter this password, so you'll likely be prompted for a password default: shortly. default: default: If you don't want to have to do this, please enable automatic default: key insertion using `config.ssh.insert_key`. default: Rsyncing folder: /cygdrive/f/st***/Pre*****/ => /var/lib/docker/docker_1447743654_45276 There was an error when attempting to rsync a synced folder. Please inspect the error message below for more info. Host path: /cygdrive/f/st***/Pre*****/ Guest path: /var/lib/docker/docker_1447743654_45276 Command: rsync --verbose --archive --delete -z --copy-links --chmod=ugo=rwX --no-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2201 -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null --exclude .vagrant/ /cygdrive/f/st***/Pre*****/ docker@127.0.0.1:/var/lib/docker/docker_1447743654_45276 Error: Warning: Permanently added '[127.0.0.1]:2201' (ECDSA) to the list of known hosts. Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,password,keyboard-interactive). rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.1] 

据我了解权限的问题,但我不知道什么权限boot2docker的或主机的。 我也尝试没有config.ssh.insert_key = true – 相同的结果。

更新:
试图从日志手动执行大的rsync命令。 显示错误

连接到主机127.0.0.1端口22:连接被拒绝

但使用ssh docker@127.0.0.1 -p 2201的直接连接成功了。

所以也许问题是rsync命令使用不正确的端口。

UPDATE2
最后, rsync -e 'ssh -p 2201' --rsync-path='sudo rsync' -avz /cygdrive/f/st***/Pre****/ docker@127.0.0.1:/var/lib/docker/docker_1447763422_11407同步一切,因为它应该是没有任何问题。 但是问题是为什么stream浪汉没有做好。