-
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
Difference in relative path handling for .env
files between v1 / v2
#10391
Comments
Relative path in compose is a nightmare, as for legacy reasons they are computed based on the first compose.yaml file configured. Seems docker compose v1 adds to the confusion by letting |
@ndeloof I agree that it is hard to choose one of ways and call it "right". As for me, if both behaviors look like something useful, then you may want to introduce a way how compose file author may choose one of them. If you can't make it perfect, make it adjustable (C). If you need some services configured the same way so that they are available for use in different "end-user" builds, you need to copy everything. Besides the fact that this make it impossible to prepare self-contained infrastructure parts, it introduce some maintenance headaches: you need to update configuration everywhere you use that common parts. |
@alexdev-wb I tend to agree, main issue is that changing anything in this area will break many existing usages. extends:
file: ./deps/common/services.yaml
resolve_relative_paths: true # relative paths in extended file are resolved based on deps/common
resolve_relative_paths: false # relative paths in extended file are not resolved and included as-is in compose model
service: service2 |
I tried to reproduce issue as reported but don't get any error, and env_file is loaded as expected from subfolder:
i.e, same as docker compose v1:
AFAIK this codebase didn't changed recently, so I don't see reason I get a different behavior (I'm running 2.17) Could you please checkout code from https://github.com/compose-spec/compose-go |
.env
files between v1 / v2
It was fixed here compose-spec/compose-go#351 , I believe. |
oh yes, forgot about this one. Closing this issue as duplicate for #10258 |
Description
Suppose we have some common service definition:
two env files:
Lets try to use common services via extends:
docker compose is looking for env files in path relative to docker-compose.yaml file location, whereas docker-compose is looking for files relative to yaml file location which contain path definition.:
compose-replative-path.tar.gz
Steps To Reproduce
Compose Version
Docker Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: