Skip to content

Commit

Permalink
Add some official docker-compose.yml scaffolding
Browse files Browse the repository at this point in the history
This includes an example `docker-compose.yml` for WordPress.
  • Loading branch information
tianon committed Feb 26, 2015
1 parent 45bb290 commit 816691a
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .template-helpers/compose.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
... via [`docker-compose`](https://github.com/docker/compose)

Example `docker-compose.yml` for `%%REPO%%`:

%%COMPOSE-YML%%
13 changes: 13 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ for repo in "${repos[@]}"; do
logo="![logo](https://raw.githubusercontent.com/docker-library/docs/master/$repo/logo.png)"
fi

compose=
composeYml=
if [ -f "$repo/docker-compose.yml" ]; then
compose="$(cat "$repo/compose.md" 2>/dev/null || cat "$helperDir/compose.md")"
composeYml="$(sed 's/^/\t/' "$repo/docker-compose.yml")"
fi

cp -v "$helperDir/template.md" "$repo/README.md"

echo ' TAGS => generate-dockerfile-links-partial.sh'
Expand All @@ -105,6 +112,12 @@ for repo in "${repos[@]}"; do
echo " LOGO => $logo"
replace_field "$repo" 'LOGO' "$logo" '\s*'

echo ' COMPOSE => '"$repo"'/compose.md'
replace_field "$repo" 'COMPOSE' "$compose"

echo ' COMPOSE-YML => '"$repo"'/docker-compose.yml'
replace_field "$repo" 'COMPOSE-YML' "$composeYml"

echo ' DOCKER-VERSIONS => '"$repo"'/docker-versions.md'
replace_field "$repo" 'DOCKER-VERSIONS' "$dockerVersions"

Expand Down
18 changes: 18 additions & 0 deletions wordpress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,24 @@ If you'd like to use an external database instead of a linked `mysql` container,
docker run --name some-wordpress -e WORDPRESS_DB_HOST=10.1.2.3:3306 \
-e WORDPRESS_DB_USER=... -e WORDPRESS_DB_PASSWORD=... -d wordpress

## ... via [`docker-compose`](https://github.com/docker/compose)

Example `docker-compose.yml` for `wordpress`:

wordpress:
image: wordpress
links:
- db:mysql
ports:
- 8080:80

db:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: example

Run `docker-compose up`, wait for it to initialize completely, and visit `http://localhost:8080` or `http://host-ip:8080`.

# Supported Docker versions

This image is officially supported on Docker version 1.5.0.
Expand Down
4 changes: 4 additions & 0 deletions wordpress/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ If you'd like to use an external database instead of a linked `mysql` container,

docker run --name some-wordpress -e WORDPRESS_DB_HOST=10.1.2.3:3306 \
-e WORDPRESS_DB_USER=... -e WORDPRESS_DB_PASSWORD=... -d wordpress

## %%COMPOSE%%

Run `docker-compose up`, wait for it to initialize completely, and visit `http://localhost:8080` or `http://host-ip:8080`.
11 changes: 11 additions & 0 deletions wordpress/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
wordpress:
image: wordpress
links:
- db:mysql
ports:
- 8080:80

db:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: example

0 comments on commit 816691a

Please sign in to comment.