@@ -89,6 +89,12 @@ def parse(cls, image_ref: str) -> Self:
8989 TagImageRef(registry='4', username='3', repository=('2',), tag='1')
9090 >>> ImageRef.parse('5/4/3/2:1')
9191 TagImageRef(registry='5', username='4', repository=('3', '2'), tag='1')
92+ >>> ImageRef.parse('localhost:5000/docker.io/ucscgi/azul-pycharm:2023.3.4-15')
93+ ... # doctest: +NORMALIZE_WHITESPACE
94+ TagImageRef(registry='localhost:5000',
95+ username='docker.io',
96+ repository=('ucscgi', 'azul-pycharm'),
97+ tag='2023.3.4-15')
9298 """
9399 if '@' in image_ref :
94100 return DigestImageRef .parse (image_ref )
@@ -215,7 +221,8 @@ class TagImageRef(ImageRef):
215221
216222 @classmethod
217223 def parse (cls , image_ref : str ) -> Self :
218- name , tag = image_ref .split (':' )
224+ # A colon in the first part of the name might separate host and port
225+ name , _ , tag = image_ref .rpartition (':' )
219226 return cls .create (name , tag )
220227
221228 @classmethod
@@ -437,7 +444,10 @@ def get_blob(self, digest: str) -> bytes:
437444
438445 @cached_property
439446 def _client (self ):
440- return DXF (host = self .host , repo = self .name , auth = self ._auth )
447+ return DXF (host = self .host ,
448+ repo = self .name ,
449+ auth = self ._auth ,
450+ insecure = self .host .startswith ('localhost:' ) or self .host == 'localhost' )
441451
442452 def _auth (self , dxf : DXFBase , response : requests .Response ):
443453 host : str = furl (response .request .url ).host
0 commit comments