ENGDOCS-1376 (#17406)

This commit is contained in:
Allie Sadler 2023-05-25 12:36:24 +01:00 committed by GitHub
parent 9897261444
commit 28e0cde463
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 46 additions and 42 deletions

View File

@ -62,17 +62,18 @@ services.
**docker-compose.yml**
```yaml
web:
image: example/my_web_app:latest
depends_on:
- db
- cache
services:
web:
image: example/my_web_app:latest
depends_on:
- db
- cache
db:
image: postgres:latest
db:
image: postgres:latest
cache:
image: redis:latest
cache:
image: redis:latest
```
In this example the development configuration exposes some ports to the
@ -81,23 +82,24 @@ host, mounts our code as a volume, and builds the web image.
**docker-compose.override.yml**
```yaml
web:
build: .
volumes:
- '.:/code'
ports:
- 8883:80
environment:
DEBUG: 'true'
services:
web:
build: .
volumes:
- '.:/code'
ports:
- 8883:80
environment:
DEBUG: 'true'
db:
command: '-d'
ports:
- 5432:5432
db:
command: '-d'
ports:
- 5432:5432
cache:
ports:
- 6379:6379
cache:
ports:
- 6379:6379
```
When you run `docker compose up` it reads the overrides automatically.
@ -109,15 +111,16 @@ repo or managed by a different team).
**docker-compose.prod.yml**
```yaml
web:
ports:
- 80:80
environment:
PRODUCTION: 'true'
services:
web:
ports:
- 80:80
environment:
PRODUCTION: 'true'
cache:
environment:
TTL: '500'
cache:
environment:
TTL: '500'
```
To deploy with this production Compose file you can run
@ -143,22 +146,24 @@ database backup.
Start with a **docker-compose.yml**.
```yaml
web:
image: example/my_web_app:latest
depends_on:
- db
services:
web:
image: example/my_web_app:latest
depends_on:
db
db:
image: postgres:latest
db:
image: postgres:latest
```
In a **docker-compose.admin.yml** add a new service to run the database
export or backup.
```yaml
dbadmin:
build: database_admin/
depends_on:
services:
dbadmin:
build: database_admin/
depends_on:
- db
```
@ -443,7 +448,6 @@ services:
- ./local:/baz
```
## Reference information
[`extends`](compose-file/05-services.md#extends)