2

我正在尝试使用Vagrant + Docker(作为提供者)为我们的下一个项目设置开发环境。我正在使用cygwin(及其 ssh 和 rsync 包)在Windows 8.1 操作系统上工作。

流浪文件:

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"] 

流浪者 --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 1.8.1

VBox 版本

Versión 5.0.16 r105871

有人找到了一个 Win 配置,可以在不使用 Host VM代理的情况下成功运行 vagrant 机器作为 docker 提供者吗?

谢谢!

4

1 回答 1

1

我整个星期五都在用头撞这个,然后今天发现了一个“Docker Toolbox”(https://docs.docker.com/toolbox/toolbox_install_windows/),它让所有的痛苦都消失了。它甚至会安装一个轻量级的 MSYS Git(给你一个 bash shell)和 VirtualBox(如果还没有安装的话)。

请注意,Docker 自己的网页在某种程度上混淆了语言。“Docker Toolbox”将安装在 Windows 7 及更高版本上。有一个更新的“Docker for Windows”(https://docs.docker.com/docker-for-windows/),它仅适用于 Windows 10 Pro 或更高版本,并且会阻止您运行任何 VirtualBox 机器,因为它使用 Hyper-V .

不幸的是,“旧的”“Docker Toolbox”曾经被称为“Docker for Windows”(至少在某些地方),所以很容易混合消息。只要注意两种不同的解决方案(Win 10 Pro + 和 Hyper-VVirtualBox 和 >= Win 7),您很快就会知道任何特定网页实际上在谈论哪一个。

是的,这是让 Docker 在 Windows 上运行的策略;我最终放弃了流浪者。

于 2016-08-06T11:24:44.850 回答