2

我正在创建一个 Windows Server 2012 的 vagrant base box,我想在内部共享它,我正在使用 Vagrant http share 和以下命令

流浪者分享--http 80

    C:\Isentia\Vagrant>vagrant share --http 80
==> dev: Detecting network information for machine...
    dev: Local machine address: 169.254.202.14
    dev: Local HTTP port: 80
    dev: Local HTTPS port: disabled
==> dev: Checking authentication and authorization...
==> dev: Creating Vagrant Share session...
    dev: Share will be at: caring-dragon-2751
==> dev: Your Vagrant Share is running! Name: caring-dragon-2751
==> dev: URL: http://caring-dragon-2751.vagrantshare.com

并在另一台机器上访问带有 vagrant up 的盒子

    C:\Isentia\DevVM>vagrant init http://caring-dragon-2751.vagrantshare.com:80
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

C:\Isentia\DevVM>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'http://caring-dragon-2751.vagrantshare.com:80' could not be fo
und. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Box file was not detected as metadata. Adding it directly...
==> default: Adding box 'http://caring-dragon-2751.vagrantshare.com:80' (v0) for
 provider: virtualbox
    default: Downloading: http://caring-dragon-2751.vagrantshare.com:80
    default: Progress: 0% (Rate: 0curl:/s, Estimated time remaining: --:--:--)
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

The requested URL returned error: 500 Internal Server Error

以下是流浪文件内容

Vagrant.configure(2) do |config| 
  config.vm.box = "BuzzNumberDevBox"
  config.vm.guest = :windows
  config.vm.communicator = "winrm"
  config.vm.boot_timeout = 600
  config.vm.graceful_halt_timeout = 600
  # Admin user name and password
  config.winrm.username = "vagrant"
  config.winrm.password = "vagrant"  
  config.vm.define "dev" do |dev|
    dev.vm.network "private_network", ip: "192.168.100.10"
    dev.vm.host_name = "vagranttests.dev"
    dev.vm.network :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct: true
  end
  config.vm.provider :virtualbox do |vb|
      # Customize the name of VM in VirtualBox manager UI:
      vb.name = "BuzzNumber-Dev-VM-Web"
  end
end

我不明白的是什么可能会阻止它从任何机器上访问。该文档要求直接使用该链接。

4

1 回答 1

0

Vagrant 共享旨在共享对托管在 VM 上的应用程序的访问,而不是用于共享实际 VM。如果你想共享虚拟机本身,你需要运行 vagrant package 来打包它,然后将它放在带有 metadata.json 的 web 服务器上,或者放在其他用户可以直接添加它的 URL 上。你能澄清一下你是想把这个盒子复制到另一台机器上还是只是访问在初始流浪盒子上运行的服务?

于 2016-07-22T22:33:52.770 回答