summaryrefslogtreecommitdiffhomepage
path: root/website/content/docs/tutorials/docker.md
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2019-11-18 13:40:27 -0800
committerAdin Scannell <ascannell@google.com>2020-04-21 12:00:59 -0700
commit957e26a6f30d40e2bff042d76a327d0a2cfbabae (patch)
tree3e95d46355585ae4661de5cef30cdca72a7c94bb /website/content/docs/tutorials/docker.md
parentdc2f198866c5fd8162a79978eb3633975d3ba11f (diff)
Move website to a simpler jekyll-based template
This will allow us to merge the site into the main repository. This merge allows the documentation to be kept up-to-date and synchronized with the main project. Builds will be triggered on any update, removing the need for the cron-based reploy.
Diffstat (limited to 'website/content/docs/tutorials/docker.md')
-rwxr-xr-xwebsite/content/docs/tutorials/docker.md75
1 files changed, 75 insertions, 0 deletions
diff --git a/website/content/docs/tutorials/docker.md b/website/content/docs/tutorials/docker.md
new file mode 100755
index 000000000..ddccbccd6
--- /dev/null
+++ b/website/content/docs/tutorials/docker.md
@@ -0,0 +1,75 @@
+---
+title: "WordPress with Docker"
+permalink: /docs/tutorials/docker/
+layout: docs
+category: User Guide
+subcategory: Tutorials
+weight: 25
+---
+
+This page shows you how to deploy a sample [WordPress][wordpress] site using
+[Docker][docker].
+
+### Before you begin
+
+[Follow these instructions][docker-install] to install runsc with Docker.
+This document assumes that the runtime name chosen is `runsc`.
+
+### Running WordPress
+
+Now, let's deploy a WordPress site using Docker. WordPress site requires
+two containers: web server in the frontend, MySQL database in the backend.
+
+First, let's define a few environment variables that are shared between both
+containers:
+
+```bash
+export MYSQL_PASSWORD=${YOUR_SECRET_PASSWORD_HERE?}
+export MYSQL_DB=wordpress
+export MYSQL_USER=wordpress
+```
+
+Next, let's start the database container running MySQL and wait until the
+database is initialized:
+
+```bash
+docker run --runtime=runsc --name mysql -d \
+ -e MYSQL_RANDOM_ROOT_PASSWORD=1 \
+ -e MYSQL_PASSWORD="${MYSQL_PASSWORD}" \
+ -e MYSQL_DATABASE="${MYSQL_DB}" \
+ -e MYSQL_USER="${MYSQL_USER}" \
+ mysql:5.7
+
+# Wait until this message appears in the log.
+docker logs mysql |& grep 'port: 3306 MySQL Community Server (GPL)'
+```
+
+Once the database is running, you can start the WordPress frontend. We use the
+`--link` option to connect the frontend to the database, and expose the
+WordPress to port 8080 on the localhost.
+
+```bash
+docker run --runtime=runsc --name wordpress -d \
+ --link mysql:mysql \
+ -p 8080:80 \
+ -e WORDPRESS_DB_HOST=mysql \
+ -e WORDPRESS_DB_USER="${MYSQL_USER}" \
+ -e WORDPRESS_DB_PASSWORD="${MYSQL_PASSWORD}" \
+ -e WORDPRESS_DB_NAME="${MYSQL_DB}" \
+ -e WORDPRESS_TABLE_PREFIX=wp_ \
+ wordpress
+```
+
+Now, you can access the WordPress website pointing your favorite browser to
+<http://localhost:8080>.
+
+Congratulations! You have just deployed a WordPress site using Docker.
+
+### What's next
+
+[Learn how to deploy WordPress with Kubernetes][wordpress-k8s].
+
+[docker]: https://www.docker.com/
+[docker-install]: /docs/user_guide/quick_start/docker/
+[wordpress]: https://wordpress.com/
+[wordpress-k8s]: /docs/tutorials/kubernetes/