mirror of
https://github.com/docker/compose.git
synced 2025-07-25 14:44:29 +02:00
Update guides to use v2 config format.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
6d2aa80435
commit
8d7b1e9047
@ -72,6 +72,8 @@ and a `docker-compose.yml` file.
|
||||
|
||||
9. Add the following configuration to the file.
|
||||
|
||||
version: '2'
|
||||
services:
|
||||
db:
|
||||
image: postgres
|
||||
web:
|
||||
@ -81,7 +83,7 @@ and a `docker-compose.yml` file.
|
||||
- .:/code
|
||||
ports:
|
||||
- "8000:8000"
|
||||
links:
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
This file defines two services: The `db` service and the `web` service.
|
||||
|
@ -95,13 +95,16 @@ Define a set of services using `docker-compose.yml`:
|
||||
1. Create a file called docker-compose.yml in your project directory and add
|
||||
the following:
|
||||
|
||||
|
||||
version: '2'
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
ports:
|
||||
- "5000:5000"
|
||||
volumes:
|
||||
- .:/code
|
||||
links:
|
||||
depends_on:
|
||||
- redis
|
||||
redis:
|
||||
image: redis
|
||||
|
@ -43,6 +43,8 @@ You'll need an empty `Gemfile.lock` in order to build our `Dockerfile`.
|
||||
|
||||
Finally, `docker-compose.yml` is where the magic happens. This file describes the services that comprise your app (a database and a web app), how to get each one's Docker image (the database just runs on a pre-made PostgreSQL image, and the web app is built from the current directory), and the configuration needed to link them together and expose the web app's port.
|
||||
|
||||
version: '2'
|
||||
services:
|
||||
db:
|
||||
image: postgres
|
||||
web:
|
||||
@ -52,7 +54,7 @@ Finally, `docker-compose.yml` is where the magic happens. This file describes th
|
||||
- .:/myapp
|
||||
ports:
|
||||
- "3000:3000"
|
||||
links:
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
### Build the project
|
||||
|
@ -41,12 +41,14 @@ and WordPress.
|
||||
Next you'll create a `docker-compose.yml` file that will start your web service
|
||||
and a separate MySQL instance:
|
||||
|
||||
version: '2'
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
command: php -S 0.0.0.0:8000 -t /code
|
||||
ports:
|
||||
- "8000:8000"
|
||||
links:
|
||||
depends_on:
|
||||
- db
|
||||
volumes:
|
||||
- .:/code
|
||||
|
Loading…
x
Reference in New Issue
Block a user