-
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
parse_host
function failing to parse paths.
#3310
Comments
Turns out this was an implementation error. def _get_docker_socket_path(self) -> Optional[str]:
"""Find the first available Docker socket path.
Returns:
Optional[Path]: Path to Docker socket if found, None otherwise
"""
try:
system = platform.system().lower()
is_mac = system == "darwin"
is_orbstack = False
home_directory = os.environ.get("HOME")
if is_mac:
try:
subprocess.run(
["orbctl", "version"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
check=True,
)
is_orbstack = True
except (subprocess.CalledProcessError, FileNotFoundError):
is_orbstack = False
docker_socket = "unix://var/run/docker.sock"
if is_orbstack:
docker_socket = f"unix:///{home_directory}/.orbstack/run/docker.sock"
return docker_socket
except Exception as e:
raise Exception(f"No valid Docker socket found: {str(e)}")
def _setup_docker_client(self) -> docker.DockerClient:
try:
socket_path = self._get_docker_socket_path()
client = docker.DockerClient(base_url=socket_path)
return client
except Exception as e:
raise Exception(f"Failed to setup docker client: {str(e)}")
def pull_docker_image(self, image) -> bool:
"""
Pull a Docker image from Nexus repository
Args:
image (str): The container image reference (e.g. "myapp:1.0").
Returns:
bool: True if pull successful, False otherwise
"""
registry = self.base_url.replace("https://", "")
client = self._setup_docker_client()
try:
client.login(
username=self.username, password=self.password, registry=registry
)
client.images.pull(image)
return True
except Exception as e:
raise Exception(f"Failed to pull {image} image: {str(e)}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello there everyone, I'm instrumenting a
pytest
suite to run end-to-end tests against our repository manager and one of the helper functions I have in place is this one, that logs in and attempts to pull a container image:But it fails to do so, here's the error that
pytest
bubbles up:I'm using
docker==7.1.0
, btw.What am I missing here?
The text was updated successfully, but these errors were encountered: