Search This Blog

Monday, 2 January 2017

Docker Wordpress

I'm considering moving this blog to a Wordpress site (not keen on how Blogger handles code snippets) and figured I could have a play by creating my own local WP host in docker.  I followed the instructions at https://docs.docker.com/compose/wordpress/

To make things a little more interesting, I decided to do the whole thing in "vanilla" Debian.

Setting up the server

I downloaded the Debian network installer ISO, mounted this in HyperV, booted the machine and followed the basic installer wizard through.  Once I had my Debian server up, I bound it to a static IP in my LAN and did an apt-get update and apt-get upgrade

OS details:

$ uname -a
Linux AquaDev1 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.6 (jessie)
Release:        8.6
Codename:       jessie

Install Docker

Next I installed Docker by following the instructions at https://docs.docker.com/engine/installation/linux/debian/

Dependencies:

These steps are required before Docker can be installed:

apt-get install apt-transport-https ca-certificates gnupg2

sudo apt-key adv \
       --keyserver hkp://ha.pool.sks-keyservers.net:80 \
       --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

sudo nano /etc/apt/sources.list.d/docker.list

Then added this line to the file:
deb https://apt.dockerproject.org/repo debian-jessie main

Docker Engine

sudo apt-get update

sudo apt-get install docker-engine

sudo service docker start

My install already had the Docker user group in place, so I gave myself sudo level access with

sudo usermod -aG docker MY_USERNAME

Install pip

Docker compose needs to be installed, and I opted to use pip for this.  I liked the idea of running docker compose in a virtual environment to try and avoid dependency hell.

sudo apt-get install python-pip

pip install virtualenv

cd /blog_compose

virtualenv venv

source venv/bin/activate   (simply use "deactivate" to exit)


Docker Compose

pip install docker-compose

create docker-compose.yml

docker-compose up -d


Wordpress

I used the docker-compose YML file from the docker site (https://docs.docker.com/compose/wordpress/) but couldn't get this to work as the Wordpress server entered a reboot loop.  I was able to extract some debug info using:

docker logs CONTAINER_ID

I suspect that the issue is related to permissions - I'll update this post when I figure it out...

No comments:

Post a Comment