-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add kill docker method #7684
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
Add kill docker method #7684
Conversation
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.
Lookin' good!
e3caa3f
to
d5e6209
Compare
"""Generates a docker infrastructure_pid string in the form of | ||
`<docker_host_base_url>:<container_id>`. | ||
""" | ||
docker_client = self._get_client() |
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.
Is getting a new client cheap? Perhaps we should be passing a client in 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 thought about it a bit yesterday, but it's a bit awkward. It's unclear when it makes the most sense to instantiate a client for sharing.
run
does not instantiate a client, but calls _create_and_start_container
and _watch_container_safe
_create_and_start_container
instantiates a client (either from a registry or the regular client), passes it to
_build_container_settings
_should_pull_image
_pull_image
_create_container
and then closes it.
_watch_container_safe
instantiates a client and passes it to _watch_container
and then closes it.
preview
instantiates and then closes
I thought about setting a property for self.client
and then instantiating it if it's None
or closed, but there's not an obvious way to check for whether or not the connection is closed without hitting what would probably be a law of demeter violation.
What I definitely should do if nothing else is not call the function twice inside of run.
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 PR adds the
kill
method for Docker containers as part of #7666