2

Vagrant + Docker (プロバイダーとして) を使用して、次のプロジェクトの開発環境をセットアップしようとしています。私はcygwin(sshおよびrsyncパッケージを含む)を使用してWindows 8.1 OSに取り組んでいます。

Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.provider "docker" do |d|
    d.build_dir = "."
  end
end

Dockerfile:

FROM ubuntu

RUN apt-get install -y software-properties-common python
RUN add-apt-repository ppa:chris-lea/node.js
RUN echo "deb http://us.archive.ubuntu.com/ubuntu/ precise universe" >> /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y nodejs
#RUN apt-get install -y nodejs=0.6.12~dfsg1-1ubuntu1
RUN mkdir /var/www

ADD app.js /var/www/app.js

CMD ["/usr/bin/node", "/var/www/app.js"] 

vagrant up --provider=docker

Bringing machine 'default' up with 'docker' provider...
==> default: Docker host is required. One will be created if necessary...
    default: Vagrant will now create or start a local VM to act as the Docker
    default: host. You'll see the output of the `vagrant up` for this VM below.
    default:
    default: Importing base box 'hashicorp/boot2docker'...
    default: Matching MAC address for NAT networking...
    default: Checking if box 'hashicorp/boot2docker' is up to date...
    default: Setting the name of the VM: docker-host_default_1461921660147_65487
    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: Machine booted and ready!
GuestAdditions versions on your host (5.0.16) 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.16 - guest version is 4.3.28 r100309
mkdir: can't create directory '/tmp/selfgz98727713': No such file or directory
Cannot create target directory /tmp/selfgz98727713
You should try option --target OtherDirectory
An error occurred during installation of VirtualBox Guest Additions 5.0.16. Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
==> default: Syncing folders to the host VM...
    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: /home/Carles/Environment/ => /var/lib/docker/docker_1461921688_64359
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /home/Carles/Environment/
Guest path: /var/lib/docker/docker_1461921688_64359
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 StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null --exclude .vagrant/ /home/Carles/Environment/ docker@127.0.0.1:/var/lib/docker/docker_1461921688_64359
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.2]

rsync --バージョン

rsync  version 3.1.2  protocol version 31
Copyright (C) 1996-2015 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
    append, ACLs, no xattrs, iconv, symtimes, prealloc

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.

vagrant --バージョン

Vagrant 1.8.1

VBox バージョン

Versión 5.0.16 r105871

ホスト VMプロキシを使用せずに、ドッカー プロバイダーとして vagrant マシンを正常に実行するための Win 構成を見つけた人はいますか?

ありがとう!

4

1 に答える 1

1

私は金曜日ずっとこれに頭をぶつけていましたが、今日、すべての痛みを解消する「Docker Toolbox」( https://docs.docker.com/toolbox/toolbox_install_windows/ ) を見つけました。まだインストールされていない場合は、軽量の MSYS Git (bash シェルも取得するため) と VirtualBox もインストールされます。

Docker 自身の Web ページでは、言語が多少混同されていることに注意してください。「Docker Toolbox」は Windows 7 以降にインストールされます。Windows 10 Pro以降のみの新しい「Docker for Windows」(https://docs.docker.com/docker-for-windows/)があり、Hyper-Vを使用しているため、VirtualBoxマシンを実行できません.

残念ながら、「古い」「Docker Toolbox」は以前は「Docker for Windows」と呼ばれていたため (少なくとも場所によっては)、簡単にメッセージが混ざり合っています。2 つの異なるソリューション (Win 10 Pro + & Hyper-V対VirtualBox および >= Win 7)に注意してください。特定の Web ページが実際に話しているのはどちらであるかがすぐにわかります。

はい、これは Windows で Docker を動作させるための戦略です。私はVagrantを放棄することになりました。

于 2016-08-06T11:24:44.850 に答える