2016-05-15 12 views
2

上boot2dockerボックスとフォルダ同期:ベイグラント:私は(Windowsの8.1上)boot2dockerベイグラントボックスでフォルダを同期しようとWindowsの

Vagrantfile

# -*- mode: ruby -*- 
# vi: set ft=ruby : 

Vagrant.configure(2) do |config| 
    config.vm.hostname = "docker-host" 
    config.vm.box = "hashicorp/boot2docker" 
    config.vm.synced_folder "./src", "/sync/src" 
end 

は、私が同期するためのいくつかの方法を試してみましたフォルダ:

タイプ(同期方法)を定義しないと、バグrantはSMBを使用します。だから、私が書かれているようなものだ:この設定実装で

config.vm.synced_folder "./src", "/sync/src", type: "smb" 

が失敗した(私がログインしてる私のWindowsアカウントの資格情報を入力してください):

$ vagrant up 
Bringing machine 'default' up with 'virtualbox' provider... 
==> default: Checking if box 'hashicorp/boot2docker' is up to date... 
==> default: Clearing any previously set forwarded ports... 
==> default: Preparing SMB shared folders... 
    default: You will be asked for the username and password to use for the SMB 
    default: folders shortly. Please use the proper username/password of your 
    default: Windows account. 
    default: 
    default: Username: My Username 
    default: Password (will be hidden): 
==> default: Clearing any previously set network interfaces... 
==> default: Preparing network interfaces based on configuration... 
    default: Adapter 1: nat 
==> default: Forwarding ports... 
    default: 2375 (guest) => 2375 (host) (adapter 1) 
    default: 22 (guest) => 2222 (host) (adapter 1) 
==> default: Running 'pre-boot' VM customizations... 
==> default: Booting VM... 
==> default: Waiting for machine to boot. This may take a few minutes... 
    default: SSH address: 127.0.0.1:2222 
    default: SSH username: docker 
    default: SSH auth method: password 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
==> default: Machine booted and ready! 
GuestAdditions versions on your host (5.0.20) and guest (4.3.28 r100309) do not match. 
The guest's platform ("tinycore") is currently not supported, will try generic Linux method... 
Copy iso file C:\Program Files/Oracle/VirtualBox/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso 
Installing Virtualbox Guest Additions 5.0.20 - guest version is 4.3.28 r100309 
mkdir: can't create directory '/tmp/selfgz99220132': No such file or directory 
Cannot create target directory /tmp/selfgz99220132 
You should try option --target OtherDirectory 
An error occurred during installation of VirtualBox Guest Additions 5.0.20. Some functionality may not work as intended. 
In most cases it is OK that the "Window System drivers" installation failed. 
==> default: Setting hostname... 
==> default: Mounting SMB shared folders... 
    default: C:/my-project/src => /sync/src 
Failed to mount folders in Linux guest. This is usually because 
the "vboxsf" file system is not available. Please verify that 
the guest additions are properly installed in the guest and 
can work properly. The command attempted was: 

mount -t cifs -o uid=`id -u docker`,gid=`getent group docker | cut -d: -f3`,sec=ntlm,credentials=/etc/smb_creds_d1d75b0a1810a196107486250f8d20f4 //169.254.152.12/d1d75b0a1810a196107486250f8d20f4 /sync/src 
mount -t cifs -o uid=`id -u docker`,gid=`id -g docker`,sec=ntlm,credentials=/etc/smb_creds_d1d75b0a1810a196107486250f8d20f4 //169.254.152.12/d1d75b0a1810a196107486250f8d20f4 /sync/src 

The error output from the last command was: 

mount: mounting //169.254.152.12/d1d75b0a1810a196107486250f8d20f4 on /sync/src failed: Invalid argument 

==> default: The previous process exited with exit code 1. 

私が使用している場合を

config.vm.synced_folder "./src", "/sync/src", type: "nfs" 

の代わりに、VagrantはまだSMB(前と同じ出力)を使用しています。私は

config.vm.synced_folder "./src", "/sync/src", type: "virtualbox" 

を使用している場合、私は私が放浪-ガトリング-rsyncをして

config.vm.synced_folder "./src", "/sync/src", type: "rsync" 

を使用する場合は

$ vagrant up 
Bringing machine 'default' up with 'virtualbox' provider... 
==> default: Checking if box 'hashicorp/boot2docker' is up to date... 
==> default: Clearing any previously set forwarded ports... 
The synced folder type 'virtualbox' is reporting as unusable for 
your current setup. Please verify you have all the proper 
prerequisites for using this shared folder type and try again. 

を取得プラグインは

vagrant plugin install vagrant-gatling-rsync 

をインストールし、Cyの中で実行しますそのほかに

$ vagrant up 
Bringing machine 'default' up with 'virtualbox' provider... 
==> default: Checking if box 'hashicorp/boot2docker' is up to date... 
==> default: Clearing any previously set network interfaces... 
==> default: Preparing network interfaces based on configuration... 
    default: Adapter 1: nat 
==> default: Forwarding ports... 
    default: 2375 (guest) => 2375 (host) (adapter 1) 
    default: 22 (guest) => 2222 (host) (adapter 1) 
==> default: Running 'pre-boot' VM customizations... 
==> default: Booting VM... 
==> default: Waiting for machine to boot. This may take a few minutes... 
    default: SSH address: 127.0.0.1:2222 
    default: SSH username: docker 
    default: SSH auth method: password 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
==> default: Machine booted and ready! 
GuestAdditions versions on your host (5.0.20) and guest (4.3.28 r100309) do not match. 
The guest's platform ("tinycore") is currently not supported, will try generic Linux method... 
Copy iso file C:\Program Files/Oracle/VirtualBox/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso 
Installing Virtualbox Guest Additions 5.0.20 - guest version is 4.3.28 r100309 
mkdir: can't create directory '/tmp/selfgz95812741': No such file or directory 
Cannot create target directory /tmp/selfgz95812741 
You should try option --target OtherDirectory 
An error occurred during installation of VirtualBox Guest Additions 5.0.20. Some functionality may not work as intended. 
In most cases it is OK that the "Window System drivers" installation failed. 
==> default: Setting hostname... 
==> default: Installing rsync to the 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/c/my-project/src/ => /sync/src 
There was an error when attempting to rsync a synced folder. 
Please inspect the error message below for more info. 

Host path: /cygdrive/c/my-project/src/ 
Guest path: /sync/src 
Command: rsync --verbose --archive --delete -z --copy-links --chmod=ugo=rwX --no-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o ControlMaster=auto -o ControlPath=C:/cygwin64/tmp/ssh.640 -o ControlPersist=10m -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null --exclude .vagrant/ /cygdrive/c/my-project/src/ [email protected]:/sync/src 
Error: Warning: Permanently added '[127.0.0.1]:2222' (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] 

==> default: The previous process exited with exit code 1. 

、私はフォルダsynchonizationを取得するにはどうすればよい

$ vagrant up 
Bringing machine 'default' up with 'virtualbox' provider... 
==> default: Checking if box 'dduportal/boot2docker' is up to date... 
==> default: Clearing any previously set forwarded ports... 
==> default: Clearing any previously set network interfaces... 
==> default: Preparing network interfaces based on configuration... 
    default: Adapter 1: nat 
    default: Adapter 2: hostonly 
==> default: Forwarding ports... 
    default: 2375 (guest) => 2375 (host) (adapter 1) 
    default: 2376 (guest) => 2376 (host) (adapter 1) 
    default: 22 (guest) => 2222 (host) (adapter 1) 
==> default: Booting VM... 
==> default: Waiting for machine to boot. This may take a few minutes... 
    default: SSH address: 127.0.0.1:2222 
    default: SSH username: docker 
    default: SSH auth method: private key 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Authentication failure. Retrying... 
    default: Warning: Authentication failure. Retrying... 
    default: Warning: Authentication failure. Retrying... 
    default: Warning: Authentication failure. Retrying... 
    default: Warning: Authentication failure. Retrying... 


==> default: Waiting for cleanup before exiting... 
Vagrant exited after cleanup due to external interrupt. 

になり、別のboot2dockerボックス

# -*- mode: ruby -*- 
# vi: set ft=ruby : 

Vagrant.configure(2) do |config| 
    config.vm.hostname = "docker-host" 
    config.vm.box = "dduportal/boot2docker" 
    config.vm.synced_folder "./src", "/sync/src" 
end 

を試してみました:GWINは(cmdは何のrsyncを持っていない)、私はこれを取得しますVagrantとboot2dockerを実行するには? Windows上dduportal/boot2docker

+0

はドッカーToolboxはboot2dockerの必要性を交換していませんか?少なくともドッカーマシンの背後にある使い方は隠されていた。なぜあなたはバゲントが必要なのか分かりません –

+1

rsyncはデフォルトのb2dボックス(Windows上)で動作する唯一の方法ですが、パスワードベースなので、rsyncは認証に失敗します。手動でフォルダを同期することは可能ですが、しばらくの間回避策を探していました。 – shiro

答えて

0

私の作業のセットアップは、次のようになります。

# -*- mode: ruby -*- 
# vi: set ft=ruby : 

Vagrant.configure(2) do |config| 
    config.vm.hostname = "docker-host" 
    config.vm.box = "dduportal/boot2docker" 
    config.vm.provision "docker" 
    config.vm.synced_folder ".", "/vagrant", type: "virtualbox" 
end 
+1

同期されたフォルダのタイプを 'virtualbox'として宣言することは役に立ちません。私はまだ '認証失敗'を取得します。 – maiermic

関連する問題