環境
- Windows 10.0.14393
準備
ファイルを配置
tree
C:\users\%USERNAME%\vagrant
└─wordpress
│ Vagrantfile
│
└─provision
wordpress.sh
Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.provider "virtualbox" do |vb|
vb.memory = 1024
end
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.network :forwarded_port, host: 8080, guest: 8080
config.vm.provision :shell, :path => "./provision/wordpress.sh", :privileged => true
# config.vm.network "private_network", ip: "192.168.0.100"
end
provision/wordpress.sh
#!/bin/sh
yum -y update
yum -y install docker
systemctl start docker
docker pull wordpress
docker pull mysql
docker run --name wp-mysql -e MYSQL_ROOT_PASSWORD=password -d mysql
docker run --name wordpress --link wp-mysql:mysql -p 8080:80 -d wordpress
仮想マシンの起動
CommandPrompt
cd C:\users\%USERNAME%\vagrant\wordpress
vagrant up
アクセスしてみる
以上