---
# System prepended metadata

title: Wordpress on Container

---

# Wordpress on Container
## ホスト情報
```
ip_address: 192.168.11.20
```
## VM情報
`Vagrantfile`
```
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.define "dc01" do |wp|
    wp.vm.hostname = "wp01"
    wp.vm.network "forwarded_port", guest: 80, host: 11080
    wp.vm.network "forwarded_port", guest: 22, host: 11022, id: "ssh"
  end
  config.vm.define "dc02" do |wp|
    wp.vm.hostname = "dc02"
    wp.vm.network "forwarded_port", guest: 80, host: 22080
    wp.vm.network "forwarded_port", guest: 22, host: 22022, id: "ssh"
  end
end
```

## Dockerのインストール
公式より: https://docs.docker.com/install/linux/docker-ce/ubuntu/
```
$ sudo apt-get update
$ sudo apt-get install -y \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo apt-key fingerprint 0EBFCD88
$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
```

## Wordpressの構築
```
$ sudo docker run --detach --publish 80:80 wordpress
```