Skip to content

Commit d49c136

Browse files
committed
Daemon expects full URL of hub in auth config dict in build payload
Signed-off-by: Joffrey F <[email protected]>
1 parent b54c76c commit d49c136

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

docker/api/build.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,10 @@ def _set_auth_headers(self, headers):
274274
self._auth_configs, registry
275275
)
276276
else:
277-
auth_data = self._auth_configs
277+
auth_data = self._auth_configs.copy()
278+
# See https://github.com/docker/docker-py/issues/1683
279+
if auth.INDEX_NAME in auth_data:
280+
auth_data[auth.INDEX_URL] = auth_data[auth.INDEX_NAME]
278281

279282
log.debug(
280283
'Sending auth config ({0})'.format(

docker/auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from .constants import IS_WINDOWS_PLATFORM
1111

1212
INDEX_NAME = 'docker.io'
13-
INDEX_URL = 'https://{0}/v1/'.format(INDEX_NAME)
13+
INDEX_URL = 'https://index.{0}/v1/'.format(INDEX_NAME)
1414
DOCKER_CONFIG_FILENAME = os.path.join('.docker', 'config.json')
1515
LEGACY_DOCKER_CONFIG_FILENAME = '.dockercfg'
1616
TOKEN_USERNAME = '<token>'
@@ -118,7 +118,7 @@ def _resolve_authconfig_credstore(authconfig, registry, credstore_name):
118118
if not registry or registry == INDEX_NAME:
119119
# The ecosystem is a little schizophrenic with index.docker.io VS
120120
# docker.io - in that case, it seems the full URL is necessary.
121-
registry = 'https://index.docker.io/v1/'
121+
registry = INDEX_URL
122122
log.debug("Looking for auth entry for {0}".format(repr(registry)))
123123
store = dockerpycreds.Store(credstore_name)
124124
try:

0 commit comments

Comments
 (0)