@@ -44,7 +44,9 @@ def get_config_header(client, registry):
4444 "No auth config in memory - loading from filesystem"
4545 )
4646 client ._auth_configs = load_config ()
47- authcfg = resolve_authconfig (client ._auth_configs , registry )
47+ authcfg = resolve_authconfig (
48+ client ._auth_configs , registry , credstore_env = client .credstore_env
49+ )
4850 # Do not fail here if no authentication exists for this
4951 # specific registry as we can have a readonly pull. Just
5052 # put the header if we can.
@@ -76,7 +78,7 @@ def get_credential_store(authconfig, registry):
7678 )
7779
7880
79- def resolve_authconfig (authconfig , registry = None ):
81+ def resolve_authconfig (authconfig , registry = None , credstore_env = None ):
8082 """
8183 Returns the authentication data from the given auth configuration for a
8284 specific registry. As with the Docker client, legacy entries in the config
@@ -91,7 +93,7 @@ def resolve_authconfig(authconfig, registry=None):
9193 'Using credentials store "{0}"' .format (store_name )
9294 )
9395 cfg = _resolve_authconfig_credstore (
94- authconfig , registry , store_name
96+ authconfig , registry , store_name , env = credstore_env
9597 )
9698 if cfg is not None :
9799 return cfg
@@ -115,13 +117,14 @@ def resolve_authconfig(authconfig, registry=None):
115117 return None
116118
117119
118- def _resolve_authconfig_credstore (authconfig , registry , credstore_name ):
120+ def _resolve_authconfig_credstore (authconfig , registry , credstore_name ,
121+ env = None ):
119122 if not registry or registry == INDEX_NAME :
120123 # The ecosystem is a little schizophrenic with index.docker.io VS
121124 # docker.io - in that case, it seems the full URL is necessary.
122125 registry = INDEX_URL
123126 log .debug ("Looking for auth entry for {0}" .format (repr (registry )))
124- store = dockerpycreds .Store (credstore_name )
127+ store = dockerpycreds .Store (credstore_name , environment = env )
125128 try :
126129 data = store .get (registry )
127130 res = {
0 commit comments