diff --git a/aiidalab_launch/profile.py b/aiidalab_launch/profile.py index df41cbd..0b20bed 100644 --- a/aiidalab_launch/profile.py +++ b/aiidalab_launch/profile.py @@ -31,7 +31,9 @@ def _default_port() -> int: # explicit function required to enable test patchin return DEFAULT_PORT -DEFAULT_IMAGE = "docker.io/aiidalab/full-stack:latest" +DEFAULT_REGISTRY = "docker.io" +DEFAULT_IMAGE_PATH = "aiidalab/full-stack:latest" +DEFAULT_IMAGE = f"{DEFAULT_REGISTRY}/{DEFAULT_IMAGE_PATH}" def _valid_volume_name(source: str) -> None: @@ -50,7 +52,7 @@ def _get_configured_host_port(container: Container) -> int | None: host_config = container.attrs["HostConfig"] return int(host_config["PortBindings"]["8888/tcp"][0]["HostPort"]) or None except (KeyError, IndexError, ValueError): - raise + pass return None @@ -158,13 +160,14 @@ def from_container(cls, container: Container) -> Profile: system_user = get_docker_env(container, "SYSTEM_USER") - print(container.image.tags) - image_tag = ( - DEFAULT_IMAGE - if DEFAULT_IMAGE in container.image.tags - else container.image.tags[0] - ) - print(f"{image_tag!r}") + if DEFAULT_IMAGE in container.image.tags: + image_tag = DEFAULT_IMAGE + # Docker seems to strip `docker.io` from the image name + # so we add it back manually. + elif DEFAULT_IMAGE_PATH in container.image.tags: + image_tag = f"{DEFAULT_REGISTRY}/{DEFAULT_IMAGE_PATH}" + else: + image_tag = container.image.tags[0] extra_destinations: list[PurePosixPath] = [ PurePosixPath(mount["Destination"]) @@ -180,8 +183,6 @@ def from_container(cls, container: Container) -> Profile: else: extra_mounts.add(":".join([str(src), str(dst), "rw"])) - print(_get_configured_host_port(container)) - return Profile( name=profile_name, port=_get_configured_host_port(container),