Skip to content

Commit

Permalink
fixes to make local registry (unauthenticated) usable
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Oct 16, 2020
1 parent cd25b41 commit 2ed984f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion binderhub/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,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:
Expand Down
2 changes: 1 addition & 1 deletion binderhub/health.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,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

Expand Down
4 changes: 4 additions & 0 deletions binderhub/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ def _default_password(self):
@gen.coroutine
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:
Expand Down

0 comments on commit 2ed984f

Please sign in to comment.