The german computer magazin c't periodical No 5 from 2/20/2016 has multiple interesting articles about docker and how to create a wordpress installation very fast. The following article explains how to install docker on Linux Mint 17.1 and summarizes the commands explained in c't about docker and how to setup a local wordpress via docker. Additional commands about docker are also explained in addition how to create your own nginx docker image. Other articles in the computer magazin explain in detail the way docker works and how to orchestrate containers.

 

 

Installation and start of docker

# execute as root
echo 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' >> /etc/apt/sources.list.d/docker.list
apt-get update
apt-get install docker-engine
service docker start

 

Download docker images and start of Wordpress

sudo mkdir /srv/docker_mysqldata
sudo docker run -d --name mysql-container -v /srv/docker_mysqldata/:/var/lib/mysql/ -e MYSQL_ROOT_PASSWORD=password mysql
sudo docker run -d --name wordpress-container --link mysql-container:mysql -p 8080:80 wordpress

 

Invocation of Wordpress

Insert http://localhost:8080 in your browser

 

Additional useful docker commands

Function Command
List active containers sudo docker ps
Stop a container sudo docker stop <containername1> <containername2> ...
Erase a container sudo docker rm <containername>
Start a container sudo docker start  <containername>
Download an image sudo docker pull <imagename>
Watch containerlogs sudo docker logs <containername>

Create a terminal session into runnning container

sudo docker exec -t -i <containername> bash
Help for a docker command

sudo docker --help

sudo docker <command> --help

 

Start a Debian in docker and create a terminalsession

sudo docker pull debian
sudo create --name=mydebian -t -i debian
sudo docker start -a -i mydebian
# or everythin in one command
docker run -i -t --name mydebian debian

 

Create you own nginx docker image

sudo mkdir /root/docker_nginx
sudo echo '<html><body><p>This is my Nginx in my first docker image</p></body></html>' > /root/docker_nginx/index.html
sudo echo -e 'FROM debian
MAINTAINER foo <This email address is being protected from spambots. You need JavaScript enabled to view it.;
RUN apt-get update && apt-get install -y nginx
ADD index.html /var/www/html/
EXPOSE 80
CMD ["nginx", "-g", "daemon off;" ]' > /root/docker_nginx/Dockerfile
docker build -t mynginx /root/docker_nginx/
docker run -d -p 8081:80 mynginx

Website to call: localhost:8081

 

Other websites with information about Docker

English:

A Quick Introduction to Docker

Getting Started with Docker: Simplifying Devops

German:

Docker Basics: Einführung in die System-Level-Virtualisierung

Linux Magazin: Docker-Container am Beispiel von Owncloud

Youtube: Docker Einführung

Add comment

Spam Kommentare sind sinnlos !
Vor der Publizierung wird jeder Beitrag auf Spam geprüft. Leider dauert es deswegen bis ein Kommentar sichtbar wird. Dafür erhält aber kein Subscriber Spam eMails.
Die eMail ist optional und nicht öffentlich sichtbar. Sie ist notwendig um eMail Benachrichtigungen zu Antworten auf Kommentare zu erhalten. Sie wird auch u.U. auch vom Seitenbetreiber genutzt um offline Kontakt aufzunehmen.

Spam comments are useless !
Any comment will be reviewed first and checked for spam. Unfortunately this delays the publishing of comments but will protect subscribers from spam.
eMail is optional and hidden and is required to get update notifications for any comments. In addition your eMail may be used by the website owner to get in contact with you offline.