-
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
Rename container when recreating it #1349
Conversation
f830ee6
to
067dd8b
Compare
|
||
options = dict(override_options) | ||
# Use a hopefully unique container name by prepending the short id | ||
self.client.rename(container.id, container.short_id + container.name) |
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 there is one possible failure case here. If compose crashes between this line , and the remove()
line, the old container will be left with the temporary name.
The next time compose runs, it wont recreate (since the container has a different name now), and any volumes will be new instances. The old volumes will still be attached to the temporary container, so they shouldn't be lost.
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.
This is also possible right now, isn't it? If Compose crashes after creating the intermediate container but before creating the new one, it won't recreate.
It's not ideal, but at least it isn't a regression ^_^
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.
Tiny thing, but right now this generates names like c8a6039dcecounter_web_1
. Could we stick an underscore between the short ID and the name?
Should close #919 too. |
Signed-off-by: Daniel Nephin <[email protected]>
067dd8b
to
6829efd
Compare
Rebased, and added the underscore to the renamed container name |
Rename container when recreating it
…. Will hopefully be fixed by docker/compose#874
Resolves #874 (and a bunch of related bug reports)