Skip to content
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

Use Compose V2 compose.yaml and DRY it out #5

Open
almereyda opened this issue Feb 10, 2023 · 4 comments
Open

Use Compose V2 compose.yaml and DRY it out #5

almereyda opened this issue Feb 10, 2023 · 4 comments
Labels
enhancement 🎇 New feature or request

Comments

@almereyda
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Currently the docker-compose.yml manifests, which do not carry a version: tag and are as such Compose v2 manifests, can also be interpreted by deprecated docker-compose clients.

This in return can lead to subtle errors in the interpretation of the provided keys and values, where implementation details have changed between docker-compose/Compose v1 and docker compose/Compose v2.

Describe the solution you'd like

mv docker-compose.yaml compose.yaml

Describe alternatives you've considered

We remain backwards compatible and support multiple runtime engines at the same time.

Additional context

Actually we want to run the stack locally in Kubernetes, but we are just not there yet.

@almereyda almereyda added the enhancement 🎇 New feature or request label Feb 10, 2023
@almereyda
Copy link
Contributor Author

almereyda commented Feb 11, 2023

If we agree on compose.yaml to reduce ambiguity and break interoperability with previous docker-compose versions, we can also use service profiles to identify components in the stack that belong together.

Their example is quite telling about which use case is targeted with this feature:

docker compose run db-migrations

Which directly relates this conversation to #2

@almereyda
Copy link
Contributor Author

Some nice patterns to use Docker Compose to its full extent can be found in:

These features could also help to structure the template better:

We can also use some YAML syntax rules to deduplicate code, namely anchors and alias nodes

as exemplified in i.e.

This is also where I learned about service_completed_successfully

Similar to them, we could also agree on better task execution runner than bash, and specify more jobs in a package.json instead.

Later we could consider more sophisticated task runners, like just et al.

In the new Compose, we can also use Docker Stack's deploy for specifying resources, if applicable (eventually good to identify memory leaks locally):

@almereyda
Copy link
Contributor Author

is a nice example about how a x-common: block and configurations therein are being reused in services et al.
It also shows how a single value can be reused.

@almereyda almereyda changed the title Use compose.yaml to refer to the Compose V2 spec explicitly Use Compose V2 compose.yaml and DRY it out Apr 20, 2023
@almereyda
Copy link
Contributor Author

In addition to the previous YAML examples, here's a writeup (found via the veggiemonk/awesome-docker list of Docker resources and projects:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🎇 New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant