Poniendo en marcha Wordpress en un contenedor, recomendado para Desarrolladores.
Luego de hablarle de las maravillas de tener un entorno virtual con muy pocos recursos (Contenedores), poder tener muchos entornos distintos para desarrollos de distintos clientes, distintas versiones, probar migraciones, nuevas versiones de componentes, un nuevo portal… las ventajas son muchas.
El mensaje es “debes estar en 2018”, lograrás optimizar recursos, bajar el tiempo de cambios, en pruebas, migraciones y un largo etc…
En este caso y como la base de datos la necesitaremos para mas de un contenedor, preferimos que MySQL esté corriendo en otro contenedor. (pueden utilizar una base de datos en el equipo real también)
# docker run --name wordpress \
-e WORDPRESS_DB_HOST=172.17.0.1:3306 \
-e WORDPRESS_DB_USER=test \
-e WORDPRESS_DB_PASSWORD=testing \
-e WORDPRESS_DB_NAME=wordpress \
-d wordpress
* http://172.17.0.2/wp-admin/install.php
El log del actividades del Contenedor
# docker logs wordpress
WordPress not found in /var/www/html - copying now...
Complete! WordPress has been successfully copied to /var/www/html
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[Thu Dec 21 11:56:43.515898 2017] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.0 configured -- resuming normal operations
[Thu Dec 21 11:56:43.515953 2017] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
172.17.0.1 - - [21/Dec/2017:11:56:52 +0000] "GET / HTTP/1.1" 302 374 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:56:52 +0000] "GET /wp-admin/install.php HTTP/1.1" 200 4243 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:56:53 +0000] "GET /wp-includes/css/dashicons.min.css?ver=4.9.1 HTTP/1.1" 200 28983 "http://172.17.0.2/wp-admin/install.php" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:57:55 +0000] "POST /wp-admin/install.php?step=1 HTTP/1.1" 200 2520 "http://172.17.0.2/wp-admin/install.php" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:57:57 +0000] "GET /wp-includes/js/zxcvbn-async.min.js?ver=1.0 HTTP/1.1" 200 581 "http://172.17.0.2/wp-admin/install.php?step=1" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:57:57 +0000] "GET /wp-admin/js/password-strength-meter.min.js?ver=4.9.1 HTTP/1.1" 200 825 "http://172.17.0.2/wp-admin/install.php?step=1" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:57:57 +0000] "GET /wp-includes/js/wp-util.min.js?ver=4.9.1 HTTP/1.1" 200 924 "http://172.17.0.2/wp-admin/install.php?step=1" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:57:57 +0000] "GET /wp-includes/js/underscore.min.js?ver=1.8.3 HTTP/1.1" 200 6174 "http://172.17.0.2/wp-admin/install.php?step=1" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:57:57 +0000] "GET /wp-admin/js/user-profile.min.js?ver=4.9.1 HTTP/1.1" 200 2657 "http://172.17.0.2/wp-admin/install.php?step=1" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:57:57 +0000] "GET /wp-includes/js/zxcvbn.min.js HTTP/1.1" 200 400374 "http://172.17.0.2/wp-admin/install.php?step=1" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
sh: 1: -t: not found
172.17.0.2 - - [21/Dec/2017:11:58:17 +0000] "GET /2017/12/21/hello-world/ HTTP/1.1" 200 19716 "http://172.17.0.2/2017/12/21/hello-world/" "WordPress/4.9.1; http://172.17.0.2"
sh: 1: -t: not found
172.17.0.1 - - [21/Dec/2017:11:58:13 +0000] "POST /wp-admin/install.php?step=2 HTTP/1.1" 200 1499 "http://172.17.0.2/wp-admin/install.php?step=1" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:58:24 +0000] "GET /wp-login.php HTTP/1.1" 200 1522 "http://172.17.0.2/wp-admin/install.php?step=2" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:58:25 +0000] "GET /wp-admin/load-styles.php?c=0&dir=ltr&load%5B%5D=dashicons,buttons,forms,l10n,login&ver=4.9.1 HTTP/1.1" 200 36373 "http://172.17.0.2/wp-login.php" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:58:36 +0000] "POST /wp-login.php HTTP/1.1" 302 1273 "http://172.17.0.2/wp-login.php" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.2 - - [21/Dec/2017:11:58:24 +0000] "POST /wp-cron.php?doing_wp_cron=1513857504.4280900955200195312500 HTTP/1.1" 200 191 "http://172.17.0.2/wp-cron.php?doing_wp_cron=1513857504.4280900955200195312500" "WordPress/4.9.1; http://172.17.0.2"
172.17.0.1 - - [21/Dec/2017:11:58:36 +0000] "GET /wp-admin/ HTTP/1.1" 200 15011 "http://172.17.0.2/wp-login.php" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:58:37 +0000] "GET /wp-includes/js/thickbox/thickbox.css?ver=4.9.1 HTTP/1.1" 200 1268 "http://172.17.0.2/wp-admin/" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:58:37 +0000] "GET /wp-includes/css/editor.min.css?ver=4.9.1 HTTP/1.1" 200 6070 "http://172.17.0.2/wp-admin/" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:58:37 +0000] "GET /wp-admin/load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate,utils&ver=4.9.1 HTTP/1.1" 200 38199 "http://172.17.0.2/wp-admin/" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:58:37 +0000] "GET /wp-admin/load-styles.php?c=0&dir=ltr&load%5B%5D=dashicons,admin-bar,common,forms,admin-menu,dashboard,list-tables,edit,revisions,media,themes,about,nav-menus,wp-pointer,widgets&load%5B%5D=,site-icon,l10n,buttons,wp-auth-check&ver=4.9.1 HTTP/1.1" 200 83335 "http://172.17.0.2/wp-admin/" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:58:37 +0000] "GET /wp-admin/load-scripts.php?c=0&load%5B%5D=hoverIntent,common,admin-bar,wp-ajax-response,jquery-color,wp-lists,quicktags,jquery-query,admin-comments,jquery-ui-core,jquery-&load%5B%5D=ui-widget,jquery-ui-mouse,jquery-ui-sortable,postbox,underscore,wp-util,wp-a11y,dashboard,thickbox,plugin-install,updates,shortc&load%5B%5D=ode,media-upload,svg-painter,heartbeat,wp-auth-check,wplink,jquery-ui-position,jquery-ui-menu,jquery-ui-autocomplete&ver=4.9.1 HTTP/1.1" 200 71281 "http://172.17.0.2/wp-admin/" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:58:37 +0000] "GET /wp-includes/js/wp-emoji-release.min.js?ver=4.9.1 HTTP/1.1" 200 4674 "http://172.17.0.2/wp-admin/" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.2 - - [21/Dec/2017:11:58:37 +0000] "POST /wp-cron.php?doing_wp_cron=1513857517.8066580295562744140625 HTTP/1.1" 200 191 "http://172.17.0.2/wp-cron.php?doing_wp_cron=1513857517.8066580295562744140625" "WordPress/4.9.1; http://172.17.0.2"
172.17.0.1 - - [21/Dec/2017:11:58:37 +0000] "GET /wp-admin/admin-ajax.php?action=wp-compression-test&test=1&_ajax_nonce=a598a933b2&1513857517767 HTTP/1.1" 200 1117 "http://172.17.0.2/wp-admin/" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:58:37 +0000] "GET /wp-includes/js/thickbox/loadingAnimation.gif HTTP/1.1" 200 15525 "http://172.17.0.2/wp-admin/" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:58:37 +0000] "GET /wp-admin/admin-ajax.php?action=wp-compression-test&test=no&_ajax_nonce=a598a933b2&1513857517931 HTTP/1.1" 200 495 "http://172.17.0.2/wp-admin/" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:58:37 +0000] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 1665 "http://172.17.0.2/wp-admin/" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:58:37 +0000] "GET /wp-admin/admin-ajax.php?action=dashboard-widgets&widget=dashboard_primary&pagenow=dashboard HTTP/1.1" 200 842 "http://172.17.0.2/wp-admin/" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:58:40 +0000] "GET /wp-admin/plugins.php HTTP/1.1" 200 11034 "http://172.17.0.2/wp-admin/" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:58:41 +0000] "GET /wp-admin/load-scripts.php?c=0&load%5B%5D=hoverIntent,common,admin-bar,underscore,wp-util,wp-a11y,updates,jquery-ui-core,thickbox,plugin-install,svg-painter,heartbeat,wp-&load%5B%5D=auth-check&ver=4.9.1 HTTP/1.1" 200 31331 "http://172.17.0.2/wp-admin/plugins.php" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:58:45 +0000] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 627 "http://172.17.0.2/wp-admin/plugins.php" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
172.17.0.1 - - [21/Dec/2017:11:58:50 +0000] "GET /wp-admin/index.php HTTP/1.1" 200 15134 "http://172.17.0.2/wp-admin/plugins.php" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
Necesita 87 mb de RAM, muy pocos recursos de CPU y Disco, gracias a que se conectará con un motor MySQL externo.
# docker stats
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
9cd31d80fbca wordpress 0.00% 87.41MiB / 7.681GiB 1.11% 1.73MB / 1.83MB 0B / 578kB 10
Vemos que solo tiene activado el puerto 80 (web), se podría utilizar otra configuración y agregar el puerto 443 (https), pero para desarrollos internos no aportará mucho valor.
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9cd31d80fbca wordpress "docker-entrypoint.s…" 6 minutes ago Up 6 minutes 80/tcp wordpress
La imágen en disco es de 410 mb.
# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
wordpress latest c0905f52a6d6 36 hours ago 410MB
Mediante un navegador podemos entrar al APP Wordpress y comenzar nuestro trabajo.
GRAFICO1: