-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Only recreate what's changed #1399
Conversation
Edit: this is now implemented. After giving it some thought, it'd be far easier to just label every container with a hash generated from the service dict that was used to create it, and compare hashes to see if a container needs recreating. This means we can avoid doing any of the configuration diffing stuff, which is (a) hairy to implement (b) full of corner cases (c) going to be a total pain to debug. Thoughts? |
I agree, I like the idea of using a hash. It should make things a lot easier. |
9326dbd
to
83923d5
Compare
Pushed an initial implementation using hashes. |
Downstream dependent services are now recreated when an upstream dependency is recreated. |
1bdfee9
to
2a8210e
Compare
8fefbb2
to
b4cd02c
Compare
This is now ready for review. |
One thing worth noting: the Compose now shows a warning if you pass |
7f2bdde
to
e5d8447
Compare
If we're just streaming logs from `docker-compose up`, we don't need to set AttachStdin/out/err, and doing so results in containers with different configuration depending on whether `up` or `run` were invoked with `-d` or not. Signed-off-by: Aanand Prasad <[email protected]>
Signed-off-by: Aanand Prasad <[email protected]>
Just rebasing this now that #1356 is in! |
and plans[name].action == 'recreate' | ||
] | ||
|
||
if updated_dependencies: |
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.
When we were chatting about #1395 I suggested to support the feature we'd probably want to store the DAG of the services in compose.project.sort_service_dicts()
instead of flattening it immediately.
I think that data structure would make this easier as well. Instead of having to lookup the dependencies for each service, we could immediately add recreate plans for all dependencies. When it's available we could consider using it here.
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.
Yeah, I think that'd be a good refactor as part of implementing #1395.
6f29b7a
to
a863857
Compare
Rebased and removed |
Whoops, the tests are still using |
Signed-off-by: Aanand Prasad <[email protected]>
Build is green. |
LGTM |
This feature isn't it any published version of docker-compose yet right? |
@prologic it was introduced in 1.3 |
As a default (no special cil option) feature? :) |
Sorry, not default, as a option to |
This one I guess :) |
Hmm what version is that?
|
|
Your totally right, i'm running 1.3.1 and should probably update :) From 1.4 changelog https://github.com/docker/compose/blob/master/CHANGELOG.md
|
👍 Awesome :) |
Closes #1345. To try it out:
Here's what needs fixing:
image
orbuild
) has changed, this should trigger a recreate.links
,volumes_from
andnet:container
should also be recreated, whether or not their configuration has changed.