Table of Content

The purpose here:

  • quick install and run all in one docker with nginx+php+mysql+wordpress
    eugeneware
  • explore docker inside

portable docker for windows

Check here if you want to know how to make portable docker toolbox for windows.

$ dockerstart

installation docker images

$ docker pull eugeneware/docker-wordpress-nginx
Using default tag: latest
latest: Pulling from eugeneware/docker-wordpress-nginx
...
Digest: sha256:d505ed12e146b22d2eabac6840ee707561dfa0dd9a51de3f5cd64d487f0f5330
Status: Downloaded newer image for eugeneware/docker-wordpress-nginx:latest

running docker

$ docker run -p 80:80 --name docker-wordpress-nginx -d eugeneware/docker-wordpress-nginx
7ac0a76ac48e954232adae4751aa406ae1db5fd038a476541ec358f157034a67

$ docker ps
CONTAINER ID        IMAGE                               COMMAND                 CREATED             STATUS              PORTS                          NAMES
7ac0a76ac48e        eugeneware/docker-wordpress-nginx   "/bin/bash /start.sh"   9 seconds ago       Up 7 seconds        0.0.0.0:80->80/tcp, 3306/tcp   docker-wordpress-nginx

$ curl http://127.0.0.1:80
curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused

when run docker client on windows, docker host is 192.168.99.100 instead of 127.0.0.1.

$ curl http://192.168.99.100:80/index.php 

explore docker wordpress-nginx

1) ssh using docker-machine

$ docker-machine ssh   
docker@default:~$ sudo df -h                                           
Filesystem                Size      Used Available Use% Mounted on         none                     17.9G      1.2G     15.8G   7% /mnt/sda1/var/lib/docker/aufs/mnt/ca973363227452db6012b270d57e1f0c50d74ee6c2f541c03b817058a3add3da  

this is docker container mounted  

2) directly ssh to docker host ip

$ ssh docker@192.168.99.100
docker@192.168.99.100's password: //default password is tcuser for docker

3) access to docker container

$ docker ps
CONTAINER ID        IMAGE                               COMMAND                 CREATED             STATUS              PORTS                          NAMES
7ac0a76ac48e        eugeneware/docker-wordpress-nginx   "/bin/bash /start.sh"   About an hour ago   Up About an hour    0.0.0.0:80->80/tcp, 3306/tcp   docker-wordpress-nginx

$ docker exec -i -t 7ac0a76ac48e /bin/bash 

4) verify running process

root@7ac0a76ac48e:/# ps -ef|egrep -i "nginx|php|mysql"
root       406   399  0 17:00 ?        00:00:00 nginx: master process /usr/sbin/nginx
mysql      407   399  0 17:00 ?        00:00:05 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/log/mysql/error.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306
root       408   399  0 17:00 ?        00:00:00 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
www-data   410   406  0 17:00 ?        00:00:00 nginx: worker process
www-data   411   406  0 17:00 ?        00:00:00 nginx: worker process
www-data   412   406  0 17:00 ?        00:00:00 nginx: worker process
www-data   413   406  0 17:00 ?        00:00:00 nginx: worker process
www-data   430   408  0 17:00 ?        00:00:02 php-fpm: pool www
www-data   431   408  0 17:00 ?        00:00:04 php-fpm: pool www
root       433   399  0 17:00 ?        00:00:00 tail -f /var/log/php5-fpm.log
www-data   441   408  0 17:08 ?        00:00:01 php-fpm: pool www
root       472   457  0 19:00 ?        00:00:00 egrep --color=auto -i nginx|php|mysql

5) where is wordpress doc root

root@7ac0a76ac48e:/usr/share/nginx/www# ll
total 192
drwxr-xr-x  5 www-data www-data  4096 Oct 31 17:09 ./
drwxr-xr-x  8 root     root      4096 Jul 10  2015 ../
-rw-r--r--  1 www-data www-data   537 Mar  4  2014 50x.html
-rw-r--r--  1 www-data www-data   418 Sep 25  2013 index.php
-rw-r--r--  1 www-data www-data 19930 Jan  1  2015 license.txt
-rw-r--r--  1 www-data www-data  7361 Oct 31 17:09 readme.html
-rw-r--r--  1 www-data www-data  4951 Aug 20  2014 wp-activate.php
drwxr-xr-x  9 www-data www-data  4096 May  7  2015 wp-admin/
-rw-r--r--  1 www-data www-data   271 Jan  8  2012 wp-blog-header.php
-rw-r--r--  1 www-data www-data  5007 Jan  8  2015 wp-comments-post.php
-rw-r--r--  1 www-data www-data  2727 Apr 12  2015 wp-config-sample.php
-rw-r--r--  1 www-data www-data  3397 Oct 31 17:00 wp-config.php
drwxr-xr-x  6 www-data www-data  4096 Oct 31 17:13 wp-content/
-rw-r--r--  1 www-data www-data  3115 Mar 17  2015 wp-cron.php
drwxr-xr-x 12 www-data www-data  4096 May  7  2015 wp-includes/
-rw-r--r--  1 www-data www-data  2380 Oct 24  2013 wp-links-opml.php
-rw-r--r--  1 www-data www-data  3123 Apr 12  2015 wp-load.php
-rw-r--r--  1 www-data www-data 34241 Apr 12  2015 wp-login.php
-rw-r--r--  1 www-data www-data  8252 Jul 17  2014 wp-mail.php
-rw-r--r--  1 www-data www-data 11048 Apr 12  2015 wp-settings.php
-rw-r--r--  1 www-data www-data 25152 Nov 30  2014 wp-signup.php
-rw-r--r--  1 www-data www-data  4035 Nov 30  2014 wp-trackback.php
-rw-r--r--  1 www-data www-data  3032 Feb  9  2014 xmlrpc.php

6) installed nginx+phh+mysql

package
root@7ac0a76ac48e:/usr/share# ll /usr/share/|egrep -i "nginx|php|mysql"
drwxr-xr-x  26 root root  4096 Jul 10  2015 mysql/
drwxr-xr-x   8 root root  4096 Jul 10  2015 nginx/
drwxr-xr-x  12 root root  4096 Jul 10  2015 php/
drwxr-xr-x  16 root root  4096 Jul 10  2015 php5/

config files 
root@7ac0a76ac48e:/usr/share# ll /etc|egrep -i "nginx|php|mysql"
drwxr-xr-x   3 root root    4096 Jul 10  2015 mysql/
drwxr-xr-x   6 root root    4096 Jul 10  2015 nginx/
drwxr-xr-x  13 root root    4096 Jul 10  2015 php5/

binary Files
root@7ac0a76ac48e:/usr/share# ll /usr/sbin|egrep -i "nginx|php|mysql"
-rwxr-xr-x  1 root root 11758528 Apr 20  2015 mysqld*
-rwxr-xr-x  1 root root   873176 Feb 11  2015 nginx*
-rwxr-xr-x  1 root root  9098432 Jul  2  2015 php5-fpm*
lrwxrwxrwx  1 root root        9 Jul  2  2015 php5dismod -> php5enmod*
-rwxr-xr-x  1 root root     6363 Jul  2  2015 php5enmod*
-rwxr-xr-x  1 root root     5169 Jul  2  2015 php5query*

7) resource usage for docker container within docker host

root@7ac0a76ac48e:/usr/share/nginx/www# df -h
Filesystem      Size  Used Avail Use% Mounted on
none             18G  1.2G   16G   7% /

it is 1.2GB here

root@7ac0a76ac48e:/usr/share/nginx/www# free -m
             total       used       free     shared    buffers     cached
Mem:           995        914         81        224         51        493
-/+ buffers/cache:        368        626
Swap:         1134          3       1131

8) resource usage for docker windows

monitor Windows Task Manager, VBOX used around 80MB 
VBoxHeadless.exe  40MB 
VBoxNetDHCP.exe   12MB 
VBoxSVC.exe       20MB

conclusion

  • lower profile for docker toolbox for windows
  • pretty good private lab for docker testing