This repository is an example configuration of Wordpress, running on multiple Docker containers. Docker Compose is used for orchestration.
This environment uses 2 containers:
web
container with Apache2 and PHP, being build fromDockerfile
. This container shares application sources with host machine.db
container with MySQL, pulled directly from tutum/mysql image on Docker Hub. This container shares DB data with boot2docker VM.
Containers are managed by Docker Compose. The configuration is in docker-compose.yml
.
Basically, you need to have Docker Compose installed.
If you are using Mac OS X or Windows as your host OS, I recommend using boot2docker as proxy VM to run Docker.
If Mac OS X is your host OS and you use boot2docker to launch Docker you will probably encounter the bug with writing to shared volume. The following workaround works perfectly:
-
SSH to boot2docker VM:
boot2docker ssh
-
Edit the
/var/lib/boot2docker/profile
file:sudo vi /var/lib/boot2docker/profile
-
Paste the following lines:
umount /Users mount -t vboxsf -o uid=33,gid=33 Users /Users
-
Exit the VM and restart it:
boot2docker restart
In the project root directory run the following command:
docker-compose up -d
This command will build web
Docker image and run its container together with db
container.
-
Log in to the container by running the following command:
docker exec -i -t dockerwordpress_web_1 bash
-
Install dependencies by running the following command:
composer install -n
In project root folder on your host machine run the following command:
docker exec -it dockerwordpress_db_1 mysql -u root -e "CREATE DATABASE wordpress;"
-
Check boot2docker IP address:
boot2docker ip
. -
Assuming its 192.168.59.103, add the following line to your
/etc/hosts
file:192.168.59.103 wordpress.dev
TBA
-
Check boot2docker IP address:
boot2docker ip
. -
Assuming its 192.168.59.103, add the following line to your
%SystemRoot%\System32\drivers\etc\hosts
file:192.168.59.103 wordpress.dev