-
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
Extend compose files by allowing multiple files #2051
Conversation
34b0aa1
to
97ee075
Compare
Ok, I've added some basic docs to the reference, cc @moxiegirl for review I think we'll probably want to add an example which uses this new default override file, but I hope we can work on that as a separate branch. |
|
||
def get_default_override_file(path): | ||
override_filename = os.path.join(path, DEFAULT_OVERRIDE_FILENAME) | ||
return [override_filename] if os.path.exists(override_filename) else [] |
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.
Do you want to log.info
if you find an override file? You might be doing this somewhere and I missed it.
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.
We don't currently log anything about which file is picked if we hit the defaults. A log.debug()
might be good for debugging.
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.
Works for me. Troubleshooting is the exact use case I was thinking of. :-D
Signed-off-by: Daniel Nephin <[email protected]>
Signed-off-by: Daniel Nephin <[email protected]>
Signed-off-by: Daniel Nephin <[email protected]>
Signed-off-by: Daniel Nephin <[email protected]>
Signed-off-by: Daniel Nephin <[email protected]>
Signed-off-by: Daniel Nephin <[email protected]>
…nfig doesn't import from cli. Signed-off-by: Daniel Nephin <[email protected]>
Signed-off-by: Daniel Nephin <[email protected]>
Signed-off-by: Daniel Nephin <[email protected]>
881e107
to
4383bb1
Compare
Signed-off-by: Daniel Nephin <[email protected]>
Signed-off-by: Daniel Nephin <[email protected]>
4383bb1
to
01b7753
Compare
@aanand I think I've addressed your comments Docs are updated as well, and added debug logging for filenames |
all_service_names = set(base) | set(override) | ||
return { | ||
name: merge_service_dicts(base.get(name, {}), override.get(name, {})) | ||
for name in all_service_names |
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.
I think this level of terseness effects the readability a bit too much and could do with expanding out, being a bit more verbose. However, I think that's something we can address in a separate PR and not block this one for now.
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.
I find it hard to be verbose (at least in code!) and always aim for greater density. Let me know how I can make this more readable.
Overall I think this is good and great to get in before code freeze and some concerns around increasing level of verbosity is non blocking, which can be addressed outside of this PR. 🌴 LGTM. |
Signed-off-by: Daniel Nephin <[email protected]>
01b7753
to
22bc174
Compare
Extend compose files by allowing multiple files
From user side just run `docker-compose run`, from CI override config with circle file. See `docker-compose` core developer description about using `docker-compose.override.yml`: docker/compose#2051 (comment)
From user side just run `docker-compose run`, from CI override config with circle file. See `docker-compose` core developer description about using `docker-compose.override.yml`: docker/compose#2051 (comment)
From user side just run `docker-compose run`, from CI override config with circle file. See `docker-compose` core developer description about using `docker-compose.override.yml`: docker/compose#2051 (comment)
Somehow I thought that |
It is not the case. The default is |
If it were defaults, it would fail with "docker-compose.override.yml is not found" |
I left out that bit, but yes, the override is considered optional. There is no flag to define an optional config |
I have a complex C++ application that needs to build with a specific set of tools and libraries. I want to perform the build inside of a container, with everything installed into system directories /usr/lib, /lib, /usr/local/bin, /usr/local/lib etc. To do the build, I mount an "external: false" volume on /usr/local/src. In the Dockerfile, I just install linux with the build tools, and then cd to /usr/local/src, and do "git clone" to download the app which has submodule dependencies for the right versions of things for each branch/tag version I have. The build works. But, I then need to have an saved container without the /usr/local/src mount (and some secrets for GitHub access) that I can then use to run the application on the target hardware/environment. How can I startup the container again, without the volume mounted nor the secrets in view? |
hey @greggwon For the secret and git credentials you can take a look to https://docs.docker.com/engine/reference/builder/#run---mounttypesecret and https://docs.docker.com/engine/reference/builder/#run---mounttypessh |
The problem is that I need the whole build environment because of the libraries that I am building and installing. But, I don't need the source tree I build from. I don't see how this removes the source tree from the resulting container. |
Resolves #1987
Add support for specifying multiple
-f
arguments todocker-compose
. Multiple files are merged onto each other to allow users to customize the composition for different environments.The default overrides file is
docker-compose.override.yml
which is applied over the defaultdocker-compose.yml
if it exists.