Skip to content
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

Improve message error when docker isn't running (#3816) #4600

Merged
merged 4 commits into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,21 @@ async def start(self) -> None:
import asyncio_atexit

import docker
from docker.errors import ImageNotFound
from docker.errors import DockerException, ImageNotFound
except ImportError as e:
raise RuntimeError(
"Missing dependecies for DockerCommandLineCodeExecutor. Please ensure the autogen-ext package was installed with the 'docker' extra."
) from e

# Start a container from the image, read to exec commands later
client = docker.from_env()
try:
client = docker.from_env()
except DockerException as e:
if "FileNotFoundError" in str(e):
raise RuntimeError("Failed to connect to Docker. Please ensure Docker is installed and running.") from e
raise
except Exception as e:
raise RuntimeError(f"Unexpected error while connecting to Docker: {str(e)}") from e

# Check if the image exists
try:
Expand Down
Loading