使用Docker Provider的Vagrant需要RSync密码

时间:2015-07-24 14:44:34

标签: docker vagrant rsync

使用docker提供程序启动vagrant(up)会产生rsync问题,因为rsync尝试与docker用户同步并询问我的密码,这当然是我没有的。如果我用一个vm.box交换docker provider一切都很好。 我收到的消息是:

WDFM32388067A:vagranttest d022051$ 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: /Users/d022051/tmp/vagranttest/ => /var/lib/docker/docker_1437748320_29948
docker@127.0.0.1's password: 
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /Users/d022051/tmp/vagranttest/
Guest path: /var/lib/docker/docker_1437748320_29948
Command: rsync --verbose --archive --delete -z --copy-links --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null --exclude .vagrant/ /Users/d022051/tmp/vagranttest/ docker@127.0.0.1:/var/lib/docker/docker_1437748320_29948
Error: Warning: Permanently added '[127.0.0.1]:2222' (RSA) to the list of known hosts.
Connection closed by 127.0.0.1
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.1]

这是Vagrant配置中的相关部分:

  config.vm.provider "docker" do |d|
    d.image = "bowline/orientdb:dev"
  end

  config.vm.synced_folder ".", "/vagrant", type: "rsync"

docker用户是否有默认密码?我是否必须在docker镜像中创建docker用户?

更新:重新启动Mac后,问题就会转变。现在的问题是,vagrant尝试在VM上安装rsync并失败。因此,请关闭此问题,因为我目前无法重现原始问题。

1 个答案:

答案 0 :(得分:10)

随着Vagrant 1.7。 tcuser使用用户名docker

正在使用的框hashicorp/boot2docker是使用此密码构建和配置的

https://github.com/mitchellh/boot2docker-vagrant-box/blob/master/template.json#L18