[Vagrant]
- DockerはまだWindows環境には早すぎた、Vagrantを使おう…
Windows上にVirtualBox+VagrantでCentOS環境構築
ここからAWS用のboxも見つかる
> vagrant init mvbcoding/awslinux > vagrant up --provider virtualbox
Vagrant
Vagrant VirtualBoxとAWS EC2での環境構築例
- Vagrant VirtualBoxとAWS EC2での環境構築例
- vagrant コマンド(起動・再起動・シャットダウン等々)備忘録
- Vagrantで立ち上げたWebサーバーにブラウザからアクセスする方法
EC2用のインスタンスを使ってVagrantを起動できる。
AWS EC2のBoxを使用してローカル環境を作る
事前にVirtualboxをインストールしておくことは必要
インストール後にVagrantfileを作成し、vagrant up
- Vagrantfile
$ cat Vagrantfile Vagrant.configure("2") do |config| config.vm.box = "mvbcoding/awslinux" config.vm.box_version = "2017.03.0.20170401" config.vm.network "forwarded_port", guest: 2300, host: 2300 end $ vagrant up --provider=virtualbox
Windows環境ではたぶん、ここまでやると以下のようなエラーが確認できると思う。
- VBoxManage.exe: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component ApplianceWrap, interface IAppliance
$ vagrant up --provider=virtualbox Bringing machine 'default' up with 'virtualbox' provider... ==> default: Importing base box 'mvbcoding/awslinux'... Progress: 90%There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below. Command: ["import", "\\\\?\\C:\\Users\\hiroyuki.nagata\\.vagrant.d\\boxes\\mvbcoding-VAGRANTSLASH-awslinux\\2017.03.0.20170401\\virtualbox\\box.ovf", "--vsys", "0", "--vmname", "amzn-ami-hvm-201703020170401-x86_64-gp2-201704051103-guest-72463CQOefdxv_default_1491390639577_72670_1521161608370_27504", "--vsys", "0", "--unit", "7", "--disk", "C:\\Users\\hiroyuki.nagata\\VirtualBox VMs\\amzn-ami-hvm-201703020170401-x86_64-gp2-201704051103-guest-72463CQOefdxv_default_1491390639577_72670_1521161608370_27504\\box-disk001.vmdk"] Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Interpreting \\?\C:\Users\hiroyuki.nagata\.vagrant.d\boxes\mvbcoding-VAGRANTSLASH-awslinux\2017.03.0.20170401\virtualbox\box.ovf... OK. 0%... Progress state: VBOX_E_FILE_ERROR VBoxManage.exe: error: Appliance import failed VBoxManage.exe: error: Could not create the imported medium 'C:\Users\hiroyuki.nagata\VirtualBox VMs\amzn-ami-hvm-201703020170401-x86_64-gp2-201704051103-guest-72463CQOefdxv_default_1491390639577_72670_1521161608370_27504\box-disk001.vmdk'. VBoxManage.exe: error: VMDK: could not create new file 'C:\Users\hiroyuki.nagata\VirtualBox VMs\amzn-ami-hvm-201703020170401-x86_64-gp2-201704051103-guest-72463CQOefdxv_default_1491390639577_72670_1521161608370_27504\box-disk001.vmdk' (VERR_ALREADY_EXISTS) VBoxManage.exe: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component ApplianceWrap, interface IAppliance VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleImportAppliance(struct HandlerArg *)" at line 886 of file VBoxManageAppliance.cpp
- 解決策
- Windows10でAmazonマシンイメージ(AMI)のVagrant boxを起動する
- Vagrant Cloud上で配られているAMIをWindowsで使う場合は、フォルダ名が長すぎるため、box.ovfファイルをいぢくる必要がある💢
- やっぱりWindowsはダメだな👎
上記の解説通り設定すると無事にVMが起動した。