3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

WindowsのVirtualBoxのVagrantのDockerでWordPress

Posted at

環境

  • Windows 10.0.14393

準備

  1. VirtualBox-5.0.28-111378-Win.exe
  2. vagrant_1.8.6.msi

ファイルを配置

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

アクセスしてみる

以上

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?