-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fix pulling with container create api #2636
base: main
Are you sure you want to change the base?
Conversation
270f5f9
to
2fc6a3d
Compare
Fix the pulling issue stated in docker#2635. Basically, similar to `docker create` it should pull the image if it does not exist locally. Signed-off-by: Navid Ali Pour <[email protected]>
2fc6a3d
to
b37a25d
Compare
I would like to see the Python SDK and Docker CLI behavior in sync, so support this PR, but should point out that the current difference is documented: docker-py/docker/models/containers.py Lines 846 to 858 in b37a25d
This PR should at least update the documentation and |
@dan-hipschman-od Thanks for your comment, I just didn't get this part would you please clarify a bit.
Thanks. |
Yea, I was just saying two things:
|
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.
Thanks for the PR!
I'm going to echo the great feedback already provided by @dan-hipschman-od:
Yea, I was just saying two things:
- Could you update the documentation of
ContainerCollection.create
so it says it will try to pull the image if it doesn't exist locally?- And
ContainerCollection.run
currently callscreate
and assumes it will not pull the image, sorun
itself catchesImageNotFound
and tries to pull the image (see below). Since you're changingcreate
to pull the image, thenrun
can be simplified:
docker-py/docker/models/containers.py
Lines 808 to 814 in b37a25d
try: container = self.create(image=image, command=command, detach=detach, **kwargs) except ImageNotFound: self.client.images.pull(image, platform=platform) container = self.create(image=image, command=command, detach=detach, **kwargs)
Fix the pulling issue stated in #2635. Basically, similar to
docker create
it should pull the image if it does not exist locally.