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

时间:2015-11-17 07:16:14

标签: docker vagrant rsync boot2docker

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

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同步了所有内容,没有任何问题。但问题是开放的,为什么流浪汉没有做好。

0 个答案:

没有答案