Enter a topic name to show or a new topic name to create; then press Enter

Install Debian on Target Server

The steps to install Debian 8 (Jessie) are as follows:

  1. Download the Debian Network install image from selecting the amd64 option under Small CD section
  2. Burn a CD from the downloaded image
  3. Boot the Target Server from the created CD
  4. Install Debian following the prompts as required (choose LXDE and Utilities in the software options)

Install Utilities on Target Server

The utilities to be installed on the Server are:

  1. nginx web server for a reverse proxy
apt-get install nginx
  1. curl and apt-transport-https for getting software
apt-get install curl apt-transport-https
  1. Install MySQL Workbench using Synaptic

Configure nginx

In the directory /etc/nginx copy the file default to default.orig in the directory /etc/nginx/sites-available and paste the contents of the configuration file below. Then stop and restart nginx.

cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.orig
server {
    listen 80;
    location / {
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection 'upgrade';
	proxy_set_header Host $host;
	proxy_cache_bypass $http_upgrade;
service nginx stop
service nginx start

Install Docker and Docker-Compose

The 2 docker related packages are:

  1. docker
  2. docker composer

The installation of docker ( is done by following the steps below:

apt-key adv --keyserver hkp:// --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
deb debian-jessie main

for LXLE the values used are

deb ubuntu-trusty main

apt-get update
apt-cache policy docker-engine
apt-get install docker-engine
curl -L`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version

NOTE: All commands that start with docker must be run as root user or preceeded by sudo

Copy an Existing Wordpress Docker Container Set

if you do not have an existing Docker Container Set then follow the instructions in the section Configure Docker Containers for Use below. If you do have a container set then copy the directory wp_docker to the location you want to run the docker set from. Verify that the paths in the volume settings of the file docker-compose.yml match your location

      image: wordpress
       - mysql
       - 8080:80
      working_dir: /var/www/html
       - /<your location>/wp-content:/var/www/html/wp-content
      image: mysql
       - MYSQL_ROOT_PASSWORD=valcom
       - MYSQL_DATABASE=wp01
       - MYSQL_USER=wp01User
       - MYSQL_PASSWORD=valcom
       - /<your location>/mysql_data:/var/lib/mysql

Configure Docker Containers for Use

Create a directory wp_docker in /root/Downloads and create a file docker-compose.yml with the contents below:

mkdir /home/valcom_web/wp_docker
touch /home/valcom_web/wp_docker/docker-compose.yml
      image: wordpress
       - mysql
       - 8080:80
      working_dir: /var/www/html
       - /home/valcom_web/wp_docker/wp-content:/var/www/html/wp-content
      image: mysql
       - MYSQL_ROOT_PASSWORD=valcom
       - MYSQL_DATABASE=wp01
       - MYSQL_USER=wp01User
       - MYSQL_PASSWORD=valcom
       - /home/valcom_web/wp_docker/mysql_data:/var/lib/mysql

Move MySQL Data for Use

Move Wordpress Data for Use

Run the MySQL and Wordpress install

cd /home/valcom_web/wp_docker
docker-compose up -d

Fix Permissions for Wordpress

In the same directory as that which you started docker run the following command to ensure write permissions are working

chmod -R 764 wp-content
cd wp-content
chusr -R www-data .
chgrp -R www-data .

Shutdown Wordpress and MySQL

The following commands will shutdown wordpress and MySQL

docker stop wpdocker_web_1
docker stop wpdocker_mysql_1

Run MySQL Docker Container Alone

If the MySQL docker container is not running as part of the Wordpress execution it is still possible to run it alone using the following command

docker run --name mysql -v /home/valcom_web/wp_docker/mysql_data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=valcom -d mysql:5.5

The standalone MySQL docker container is stopped and removed using the following command (no data is lost).

docker rm -f mysql

Configure MySQL Workbench

Troubleshoot docker installation

This introduces some of the docker troubleshooting commands

Review docker container network properties

docker inspect wpdocker_mysql_1
docker inspect wpdocker_web_1

Determine running docker containers

docker ps

Determine all defined docker containers

docker ps -a

Show docker container logfiles

docker logs wpdocker_mysql_1
docker logs wpdocker_web_1

Connect to a mysql instance running inside a docker container

The command below starts a bash session in the container

docker exec -it wpdocker_mysql_1 bash

then issue a mysql command to connect to the mysql server in the container

mysql -u root -p --host

after that you will be in a mysql session on the command line

Problems with mysql connections

Somewhere in mysql 5.6 the permission for a user that granted access on localhost failed when the mysql instance was running on an internal network. The message for what the failure was did not get corrected until the latest version of mysql 5.7. In order to correct connection issues it may be necessary to issue a grant command using either "MySQL" Workbench or by executing a mysql command directly on the instance

grant all privileges on wp01.* to 'wp01User'@'' identified by 'valcom';

Where wp01 is the wordpress database name, wp01User is the wordpress user and is the ip address of the web (not the mysql) container.

Version: 29   Revised: 2016-05-17 19:04:38 Last Updated by: 2001:470:b0ad:1:8196:d83:dcd8:872f Rename Show Links to Topic