updated Wordpress example to be easier to follow, added/updated images

docs update per Mary's comments on the PR

Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
This commit is contained in:
Victoria Bialas 2016-02-22 18:50:09 -08:00
parent 1d67e6f0f0
commit e6797e1166
9 changed files with 112 additions and 68 deletions

View File

@ -10,10 +10,9 @@ weight=4
<![end-metadata]--> <![end-metadata]-->
# Quickstart: Compose and Django # Quickstart: Docker Compose and Django
This quick-start guide demonstrates how to use Compose to set up and run a This quick-start guide demonstrates how to use Docker Compose to set up and run a simple Django/PostgreSQL app. Before starting, you'll need to have
simple Django/PostgreSQL app. Before starting, you'll need to have
[Compose installed](install.md). [Compose installed](install.md).
## Define the project components ## Define the project components

View File

@ -12,7 +12,7 @@ weight=-85
# Getting Started # Getting Started
On this page you build a simple Python web application running on Compose. The On this page you build a simple Python web application running on Docker Compose. The
application uses the Flask framework and increments a value in Redis. While the application uses the Flask framework and increments a value in Redis. While the
sample uses Python, the concepts demonstrated here should be understandable even sample uses Python, the concepts demonstrated here should be understandable even
if you're not familiar with it. if you're not familiar with it.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

View File

@ -9,9 +9,9 @@ weight=5
+++ +++
<![end-metadata]--> <![end-metadata]-->
## Quickstart: Compose and Rails ## Quickstart: Docker Compose and Rails
This Quickstart guide will show you how to use Compose to set up and run a Rails/PostgreSQL app. Before starting, you'll need to have [Compose installed](install.md). This Quickstart guide will show you how to use Docker Compose to set up and run a Rails/PostgreSQL app. Before starting, you'll need to have [Compose installed](install.md).
### Define the project ### Define the project

View File

@ -10,42 +10,44 @@ weight=6
<![end-metadata]--> <![end-metadata]-->
# Quickstart: Compose and WordPress # Quickstart: Docker Compose and WordPress
You can use Compose to easily run WordPress in an isolated environment built You can use Docker Compose to easily run WordPress in an isolated environment built
with Docker containers. with Docker containers. This quick-start guide demonstrates how to use Compose to set up and run WordPress. Before starting, you'll need to have
[Compose installed](install.md).
## Define the project ## Define the project
First, [Install Compose](install.md) and then download WordPress into the 1. Create an empty project directory.
current directory:
$ curl https://wordpress.org/latest.tar.gz | tar -xvzf - You can name the directory something easy for you to remember. This directory is the context for your application image. The directory should only contain resources to build that image.
This will create a directory called `wordpress`. If you wish, you can rename it This project directory will contain a `Dockerfile`, a `docker-compose.yaml` file, along with a downloaded `wordpress` directory and a custom `wp-config.php`, all of which you will create in the following steps.
to the name of your project.
Next, inside that directory, create a `Dockerfile`, a file that defines what 2. Change directories into your project directory.
environment your app is going to run in. For more information on how to write
Dockerfiles, see the For example, if you named your directory `my_wordpress`:
[Docker user guide](https://docs.docker.com/engine/userguide/dockerimages/#building-an-image-from-a-dockerfile) and the
[Dockerfile reference](https://docs.docker.com/engine/reference/builder/). In $ cd my-wordpress/
this case, your Dockerfile should be:
3. Create a `Dockerfile`, a file that defines the environment in which your application will run.
For more information on how to write Dockerfiles, see the [Docker Engine user guide](https://docs.docker.com/engine/userguide/dockerimages/#building-an-image-from-a-dockerfile) and the [Dockerfile reference](https://docs.docker.com/engine/reference/builder/).
In this case, your Dockerfile should include these two lines:
FROM orchardup/php5 FROM orchardup/php5
ADD . /code ADD . /code
This tells Docker how to build an image defining a container that contains PHP This tells the Docker Engine daemon how to build an image defining a container that contains PHP and WordPress.
and WordPress.
Next you'll create a `docker-compose.yml` file that will start your web service 4. Create a `docker-compose.yml` file that will start your web service and a separate MySQL instance:
and a separate MySQL instance:
version: '2' version: '2'
services: services:
web: web:
build: . build: .
command: php -S 0.0.0.0:8000 -t /code command: php -S 0.0.0.0:8000 -t /code/wordpress/
ports: ports:
- "8000:8000" - "8000:8000"
depends_on: depends_on:
@ -57,9 +59,15 @@ and a separate MySQL instance:
environment: environment:
MYSQL_DATABASE: wordpress MYSQL_DATABASE: wordpress
A supporting file is needed to get this working. `wp-config.php` is 5. Download WordPress into the current directory:
the standard WordPress config file with a single change to point the database
configuration at the `db` container: $ curl https://wordpress.org/latest.tar.gz | tar -xvzf -
This creates a directory called `wordpress` in your project directory.
6. Create a `wp-config.php` file within the `wordpress` directory.
A supporting file is needed to get this working. At the top level of the wordpress directory, add a new file called `wp-config.php` as shown. This is the standard WordPress config file with a single change to point the database configuration at the `db` container:
<?php <?php
define('DB_NAME', 'wordpress'); define('DB_NAME', 'wordpress');
@ -86,12 +94,49 @@ configuration at the `db` container:
define('ABSPATH', dirname(__FILE__) . '/'); define('ABSPATH', dirname(__FILE__) . '/');
require_once(ABSPATH . 'wp-settings.php'); require_once(ABSPATH . 'wp-settings.php');
?>
7. Verify the contents and structure of your project directory.
<!--
Dockerfile
docker-compose.yaml
wordpress/
index.php
license.txt
readme.html
wp-activate.php
wp-admin/
wp-blog-header.php
wp-comments-post.php
wp-config-sample.php
wp-config.php
wp-content/
wp-cron.php
wp-includes/
wp-links-opml.php
wp-load.php
wp-login.php
wp-mail.php
wp-settings.php
wp-signup.php
wp-trackback.php
xmlrpc.php
-->
![WordPress files](images/wordpress-files.png)
### Build the project ### Build the project
With those four files in place, run `docker-compose up` inside your WordPress With those four new files in place, run `docker-compose up` from your project directory. This will pull and build the needed images, and then start the web and database containers.
directory and it'll pull and build the needed images, and then start the web and
database containers. If you're using [Docker Machine](https://docs.docker.com/machine/), then `docker-machine ip MACHINE_VM` gives you the machine address and you can open `http://MACHINE_VM_IP:8000` in a browser. If you're using [Docker Machine](https://docs.docker.com/machine/), then `docker-machine ip MACHINE_VM` gives you the machine address and you can open `http://MACHINE_VM_IP:8000` in a browser.
At this point, WordPress should be running on port `8000` of your Docker Host, and you can complete the "famous five-minute installation" as a WordPress administrator.
![Choose language for WordPress install](images/wordpress-lang.png)
![WordPress Welcome](images/wordpress-welcome.png)
## More Compose documentation ## More Compose documentation