Merge pull request #550 from davidwilliamson/patch-1

Update compose example to work better with swarm
This commit is contained in:
John Mulhausen 2016-11-17 17:30:14 -08:00 committed by GitHub
commit 0b71b84ad4
1 changed files with 8 additions and 6 deletions

View File

@ -33,7 +33,7 @@ with Docker containers. This quick-start guide demonstrates how to use Compose t
db: db:
image: mysql:5.7 image: mysql:5.7
volumes: volumes:
- "./.data/db:/var/lib/mysql" - db_data:/var/lib/mysql
restart: always restart: always
environment: environment:
MYSQL_ROOT_PASSWORD: wordpress MYSQL_ROOT_PASSWORD: wordpress
@ -45,19 +45,17 @@ with Docker containers. This quick-start guide demonstrates how to use Compose t
depends_on: depends_on:
- db - db
image: wordpress:latest image: wordpress:latest
links:
- db
ports: ports:
- "8000:80" - "8000:80"
restart: always restart: always
environment: environment:
WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_PASSWORD: wordpress WORDPRESS_DB_PASSWORD: wordpress
volumes:
db_data:
``` ```
**NOTE**: The folder `./.data/db` will be automatically created in the project directory **NOTE**: The docker volume `db_data` will persist any updates made by wordpress to the database. [Learn more about docker volumes](../engine/tutorials/dockervolumes.md)
alongside the `docker-compose.yml` which will persist any updates made by wordpress to the
database.
### Build the project ### Build the project
@ -97,6 +95,10 @@ At this point, WordPress should be running on port `8000` of your Docker Host, a
![WordPress Welcome](images/wordpress-welcome.png) ![WordPress Welcome](images/wordpress-welcome.png)
### Shutdown/Clean up
`docker-compose down` will remove the containers and default network, but preserve your wordpress database.
`docker-compose down --volumes` will remove the containers, default network, and the wordpress database.
## More Compose documentation ## More Compose documentation
- [User guide](index.md) - [User guide](index.md)