【发布时间】:2018-03-24 02:20:44
【问题描述】:
我使用 vagrant 创建了一个虚拟机并尝试插入一个 cd,但我意识到没有安装这样的设备来读取它。
一个选项是转到我的提供程序 UI 并通过设置添加我需要的内容。
我想知道是否有任何方法可以将此设置(将 cdrom 设备添加到 VM)插入到 vagrant 文件中。
我的提供者是 VirtualBox。
>>更新
混合来自 here 和 here 的信息,并扩展我想出的 Vagrantfile 中已经存在的一些代码示例
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
...
...
config.vm.provider :virtualbox do |vb|
vb.customize ["storagectl", :id, "--name", "IDEController", "--add", "ide"]
vb.customize ["storageattach", :id, "--storagectl", "IDEController", "--port", "0", "--device", "0", "--type", "dvddrive", "--medium", "none"]
vb.customize ["modifyvm", :id, "--boot1", "disk", "--boot2", "dvd"]
end
...
...
end
在 Vagrantfile 中。
问题是现在,当尝试执行vagrant reload 时,我得到了
VBoxManage.exe: error: No storage device attached to device slot 0 on port 0
【问题讨论】:
-
谢谢,我会试试的。现在我使用的虚拟化不是基于 Vagrat,所以我必须安装它并检查它。
标签: virtualbox vagrant