-
Notifications
You must be signed in to change notification settings - Fork 310
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 error message when docker isn't running #2942
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -227,7 +227,7 @@ def exist(self) -> Optional[bool]: | |
Return None if failed to check if the image exists due to the permission issue or other reasons. | ||
""" | ||
import docker | ||
from docker.errors import APIError, ImageNotFound | ||
from docker.errors import APIError, DockerException, ImageNotFound | ||
|
||
try: | ||
client = docker.from_env() | ||
|
@@ -278,6 +278,16 @@ def exist(self) -> Optional[bool]: | |
f" pip install --upgrade docker" | ||
) | ||
|
||
if isinstance(e, DockerException) and "Error while fetching server API version" in str(e): | ||
click.secho( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the image exists in your There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup. But I don't think we want to hide the fact that docker should generally be running. If it's not clear, the user will eventually run into images that don't exist in their registry and they will get image pull failures they don't understand. This happened today. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe I should change the "error message" wording in the PR title, but this change doesn't block images being found and used if the docker is off but the image exists There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's write out these details in the message. Something like: "Docker is not running and flytekit will assume that the image exists in your registry. If you want to build the image, please install docker: ..." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea, will do! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I was going to change the The current suggestion actually mentions that docker isn't running if it catches the exact error docker throws, then the Do you think it's not clear that those two are associated? Happy to keep it general and just toss in the mention of docker in |
||
"Unable to connect to Docker daemon. Please ensure Docker is installed and running.\n" | ||
"You can start Docker by:\n" | ||
" - Windows/Mac: Start the Docker Desktop application\n" | ||
" - Linux: Run 'sudo systemctl start docker'", | ||
fg="red", | ||
) | ||
return None | ||
|
||
click.secho(f"Failed to check if the image exists with error:\n {e}", fg="red") | ||
return None | ||
|
||
|
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.
nit: I'd like to see the original error still.
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! I'll make sure the original error is still shown.