-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs for using multiple compose files #2290
Changes from all commits
7014cab
1c4c7cc
c5cf5cf
eab265b
8bdde9a
e503e08
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,44 +168,29 @@ accessible to linked services. Only the internal port can be specified. | |
Extend another service, in the current file or another, optionally overriding | ||
configuration. | ||
|
||
Here's a simple example. Suppose we have 2 files - **common.yml** and | ||
**development.yml**. We can use `extends` to define a service in | ||
**development.yml** which uses configuration defined in **common.yml**: | ||
You can use `extends` on any service together with other configuration keys. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use
The If you omit the You can extend a service that itself extends another. You can extend |
||
The `extends` value must be a dictionary defined with a required `service` | ||
and an optional `file` key. | ||
|
||
**common.yml** | ||
extends: | ||
file: common.yml | ||
service: webapp | ||
|
||
webapp: | ||
build: ./webapp | ||
environment: | ||
- DEBUG=false | ||
- SEND_EMAILS=false | ||
The `service` the name of the service being extended, for example | ||
`web` or `database`. The `file` is the location of a Compose configuration | ||
file defining that service. | ||
|
||
**development.yml** | ||
If you omit the `file` Compose looks for the service configuration in the | ||
current file. The `file` value can be an absolute or relative path. If you | ||
specify a relative path, Compose treats it as relative to the location of the | ||
current file. | ||
|
||
web: | ||
extends: | ||
file: common.yml | ||
service: webapp | ||
ports: | ||
- "8000:8000" | ||
links: | ||
- db | ||
environment: | ||
- DEBUG=true | ||
db: | ||
image: postgres | ||
|
||
Here, the `web` service in **development.yml** inherits the configuration of | ||
the `webapp` service in **common.yml** - the `build` and `environment` keys - | ||
and adds `ports` and `links` configuration. It overrides one of the defined | ||
environment variables (DEBUG) with a new value, and the other one | ||
(SEND_EMAILS) is left untouched. | ||
|
||
The `file` key is optional, if it is not set then Compose will look for the | ||
service within the current file. | ||
You can extend a service that itself extends another. You can extend | ||
indefinitely. Compose does not support circular references and `docker-compose` | ||
returns an error if it encounters one. | ||
|
||
For more on `extends`, see the [tutorial](extends.md#example) and | ||
[reference](extends.md#reference). | ||
For more on `extends`, see the | ||
[the extends documentation](extends.md#extending-services). | ||
|
||
### external_links | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @SvenDowideit as well on this change. I'm pretty sure the old setup wasn't setting the correct volume path. With this I was able to see my changes immediately by just refreshing.
I hear hugo does livereload as well, but I don't see it injecting the livereload.js