diff --git a/binderhub/builder.py b/binderhub/builder.py index 4527251720..d8d7d9ec69 100644 --- a/binderhub/builder.py +++ b/binderhub/builder.py @@ -306,7 +306,7 @@ async def get(self, provider_prefix, _unescaped_spec): if self.settings['use_registry']: for _ in range(3): try: - image_manifest = await self.registry.get_image_manifest(*'/'.join(image_name.split('/')[-2:]).split(':', 1)) + image_manifest = await self.registry.get_image_manifest(*'/'.join(image_name.split('/')[-2:]).rsplit(':', 1)) image_found = bool(image_manifest) break except HTTPClientError: diff --git a/binderhub/health.py b/binderhub/health.py index ed12088667..93d13871df 100644 --- a/binderhub/health.py +++ b/binderhub/health.py @@ -147,7 +147,7 @@ async def check_docker_registry(self): # don't care if the image actually exists or not image_name = self.settings["image_prefix"] + "some-image-name:12345" await registry.get_image_manifest( - *'/'.join(image_name.split('/')[-2:]).split(':', 1) + *'/'.join(image_name.split('/')[-2:]).rsplit(':', 1) ) return True diff --git a/binderhub/registry.py b/binderhub/registry.py index a36f636d0d..0b8c37b340 100644 --- a/binderhub/registry.py +++ b/binderhub/registry.py @@ -187,6 +187,10 @@ def _default_password(self): async def get_image_manifest(self, image, tag): client = httpclient.AsyncHTTPClient() + if '/' in image: + # this handles the case of the image name including the registry + # e.g. localhost:32000/my-image + registry_prefix, image = image.split('/', 1) url = "{}/v2/{}/manifests/{}".format(self.url, image, tag) # first, get a token to perform the manifest request if self.token_url: