Replace backtick code blocks with indentation

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
Aanand Prasad 2015-06-21 12:37:20 -07:00
parent 911cd60360
commit 511fc4a05c
3 changed files with 157 additions and 188 deletions

View File

@ -28,25 +28,21 @@ the configuration around.
When defining any service in `docker-compose.yml`, you can declare that you are
extending another service like this:
```yaml
web:
extends:
file: common-services.yml
service: webapp
```
This instructs Compose to re-use the configuration for the `webapp` service
defined in the `common-services.yml` file. Suppose that `common-services.yml`
looks like this:
```yaml
webapp:
build: .
ports:
- "8000:8000"
volumes:
- "/data"
```
In this case, you'll get exactly the same result as if you wrote
`docker-compose.yml` with that `build`, `ports` and `volumes` configuration
@ -55,7 +51,6 @@ defined directly under `web`.
You can go further and define (or re-define) configuration locally in
`docker-compose.yml`:
```yaml
web:
extends:
file: common-services.yml
@ -63,11 +58,9 @@ web:
environment:
- DEBUG=1
cpu_shares: 5
```
You can also write other services and link your `web` service to them:
```yaml
web:
extends:
file: common-services.yml
@ -79,7 +72,6 @@ web:
- db
db:
image: postgres
```
For full details on how to use `extends`, refer to the [reference](#reference).
@ -271,7 +263,6 @@ For single-value options like `image`, `command` or `mem_limit`, the new value
replaces the old value. **This is the default behaviour - all exceptions are
listed below.**
```yaml
# original service
command: python app.py
@ -280,12 +271,10 @@ command: python otherapp.py
# result
command: python otherapp.py
```
In the case of `build` and `image`, using one in the local service causes
Compose to discard the other, if it was defined in the original service.
```yaml
# original service
build: .
@ -294,9 +283,7 @@ image: redis
# result
image: redis
```
```yaml
# original service
image: redis
@ -305,12 +292,10 @@ build: .
# result
build: .
```
For the **multi-value options** `ports`, `expose`, `external_links`, `dns` and
`dns_search`, Compose concatenates both sets of values:
```yaml
# original service
expose:
- "3000"
@ -325,12 +310,10 @@ expose:
- "3000"
- "4000"
- "5000"
```
In the case of `environment` and `labels`, Compose "merges" entries together
with locally-defined values taking precedence:
```yaml
# original service
environment:
- FOO=original
@ -346,12 +329,10 @@ environment:
- FOO=original
- BAR=local
- BAZ=local
```
Finally, for `volumes` and `devices`, Compose "merges" entries together with
locally-defined bindings taking precedence:
```yaml
# original service
volumes:
- /original-dir/foo:/foo
@ -367,7 +348,6 @@ volumes:
- /original-dir/foo:/foo
- /local-dir/bar:/bar
- /local-dir/baz/:baz
```
## Compose documentation

View File

@ -29,7 +29,6 @@ they can be run together in an isolated environment:
A `docker-compose.yml` looks like this:
```yaml
web:
build: .
ports:
@ -40,7 +39,6 @@ web:
- redis
redis:
image: redis
```
Compose has commands for managing the whole lifecycle of your application:
@ -79,7 +77,6 @@ Next, you'll want to make a directory for the project:
Inside this directory, create `app.py`, a simple web app that uses the Flask
framework and increments a value in Redis:
```python
from flask import Flask
from redis import Redis
import os
@ -93,7 +90,6 @@ def hello():
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)
```
Next, define the Python dependencies in a file called `requirements.txt`:

View File

@ -32,10 +32,8 @@ Dockerfiles, see the
[Dockerfile reference](http://docs.docker.com/reference/builder/). In this case,
your Dockerfile should be:
```
FROM orchardup/php5
ADD . /code
```
This tells Docker how to build an image defining a container that contains PHP
and Wordpress.
@ -43,7 +41,6 @@ and Wordpress.
Next you'll create a `docker-compose.yml` file that will start your web service
and a separate MySQL instance:
```
web:
build: .
command: php -S 0.0.0.0:8000 -t /code
@ -57,13 +54,11 @@ db:
image: orchardup/mysql
environment:
MYSQL_DATABASE: wordpress
```
Two supporting files are needed to get this working - first, `wp-config.php` is
the standard Wordpress config file with a single change to point the database
configuration at the `db` container:
```
<?php
define('DB_NAME', 'wordpress');
define('DB_USER', 'root');
@ -89,11 +84,9 @@ if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
require_once(ABSPATH . 'wp-settings.php');
```
Second, `router.php` tells PHP's built-in web server how to run Wordpress:
```
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
@ -110,7 +103,7 @@ if(file_exists($root.$path))
require_once $root.$path;
}
}else include_once 'index.php';
```
### Build the project
With those four files in place, run `docker-compose up` inside your Wordpress