mirror of
https://github.com/docker/compose.git
synced 2025-07-20 20:24:30 +02:00
Update guides to use v2 config format.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
4de12ad7a1
commit
471264239f
@ -72,17 +72,19 @@ and a `docker-compose.yml` file.
|
|||||||
|
|
||||||
9. Add the following configuration to the file.
|
9. Add the following configuration to the file.
|
||||||
|
|
||||||
db:
|
version: '2'
|
||||||
image: postgres
|
services:
|
||||||
web:
|
db:
|
||||||
build: .
|
image: postgres
|
||||||
command: python manage.py runserver 0.0.0.0:8000
|
web:
|
||||||
volumes:
|
build: .
|
||||||
- .:/code
|
command: python manage.py runserver 0.0.0.0:8000
|
||||||
ports:
|
volumes:
|
||||||
- "8000:8000"
|
- .:/code
|
||||||
links:
|
ports:
|
||||||
- db
|
- "8000:8000"
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
|
||||||
This file defines two services: The `db` service and the `web` service.
|
This file defines two services: The `db` service and the `web` service.
|
||||||
|
|
||||||
|
@ -95,16 +95,19 @@ Define a set of services using `docker-compose.yml`:
|
|||||||
1. Create a file called docker-compose.yml in your project directory and add
|
1. Create a file called docker-compose.yml in your project directory and add
|
||||||
the following:
|
the following:
|
||||||
|
|
||||||
web:
|
|
||||||
build: .
|
version: '2'
|
||||||
ports:
|
services:
|
||||||
- "5000:5000"
|
web:
|
||||||
volumes:
|
build: .
|
||||||
- .:/code
|
ports:
|
||||||
links:
|
- "5000:5000"
|
||||||
- redis
|
volumes:
|
||||||
redis:
|
- .:/code
|
||||||
image: redis
|
depends_on:
|
||||||
|
- redis
|
||||||
|
redis:
|
||||||
|
image: redis
|
||||||
|
|
||||||
This Compose file defines two services, `web` and `redis`. The web service:
|
This Compose file defines two services, `web` and `redis`. The web service:
|
||||||
|
|
||||||
|
@ -49,17 +49,19 @@ 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
|
the web app is built from the current directory), and the configuration needed
|
||||||
to link them together and expose the web app's port.
|
to link them together and expose the web app's port.
|
||||||
|
|
||||||
db:
|
version: '2'
|
||||||
image: postgres
|
services:
|
||||||
web:
|
db:
|
||||||
build: .
|
image: postgres
|
||||||
command: bundle exec rails s -p 3000 -b '0.0.0.0'
|
web:
|
||||||
volumes:
|
build: .
|
||||||
- .:/myapp
|
command: bundle exec rails s -p 3000 -b '0.0.0.0'
|
||||||
ports:
|
volumes:
|
||||||
- "3000:3000"
|
- .:/myapp
|
||||||
links:
|
ports:
|
||||||
- db
|
- "3000:3000"
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
|
||||||
### Build the project
|
### Build the project
|
||||||
|
|
||||||
|
@ -41,19 +41,21 @@ and WordPress.
|
|||||||
Next you'll create a `docker-compose.yml` file that will start your web service
|
Next you'll create a `docker-compose.yml` file that will start your web service
|
||||||
and a separate MySQL instance:
|
and a separate MySQL instance:
|
||||||
|
|
||||||
web:
|
version: '2'
|
||||||
build: .
|
services:
|
||||||
command: php -S 0.0.0.0:8000 -t /code
|
web:
|
||||||
ports:
|
build: .
|
||||||
- "8000:8000"
|
command: php -S 0.0.0.0:8000 -t /code
|
||||||
links:
|
ports:
|
||||||
- db
|
- "8000:8000"
|
||||||
volumes:
|
depends_on:
|
||||||
- .:/code
|
- db
|
||||||
db:
|
volumes:
|
||||||
image: orchardup/mysql
|
- .:/code
|
||||||
environment:
|
db:
|
||||||
MYSQL_DATABASE: wordpress
|
image: orchardup/mysql
|
||||||
|
environment:
|
||||||
|
MYSQL_DATABASE: wordpress
|
||||||
|
|
||||||
A supporting file is needed to get this working. `wp-config.php` is
|
A supporting file is needed to get this working. `wp-config.php` is
|
||||||
the standard WordPress config file with a single change to point the database
|
the standard WordPress config file with a single change to point the database
|
||||||
|
Loading…
x
Reference in New Issue
Block a user