mirror of https://github.com/docker/docker-py.git
Pass X-Registry-Auth when building an image
* Initialize headers variable in BuildApiMixin.build() as a dict rather
than as None. This way the correct object gets passed to
_set_auth_headers() even if no headers were set in build()
* Changing object from None to {} in BuildApiMixin._set_auth_headers()
removed because it changes the object reference, so has no effect on
calling code.
Signed-off-by: Justin Michalicek <jmichalicek@gmail.com>
This commit is contained in:
parent
5e47026a9b
commit
66e7af9353
|
|
@ -18,7 +18,8 @@ class BuildApiMixin(object):
|
||||||
custom_context=False, encoding=None, pull=False,
|
custom_context=False, encoding=None, pull=False,
|
||||||
forcerm=False, dockerfile=None, container_limits=None,
|
forcerm=False, dockerfile=None, container_limits=None,
|
||||||
decode=False, buildargs=None, gzip=False):
|
decode=False, buildargs=None, gzip=False):
|
||||||
remote = context = headers = None
|
remote = context = None
|
||||||
|
headers = {}
|
||||||
container_limits = container_limits or {}
|
container_limits = container_limits or {}
|
||||||
if path is None and fileobj is None:
|
if path is None and fileobj is None:
|
||||||
raise TypeError("Either path or fileobj needs to be provided.")
|
raise TypeError("Either path or fileobj needs to be provided.")
|
||||||
|
|
@ -134,8 +135,7 @@ class BuildApiMixin(object):
|
||||||
', '.join(repr(k) for k in self._auth_configs.keys())
|
', '.join(repr(k) for k in self._auth_configs.keys())
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if headers is None:
|
|
||||||
headers = {}
|
|
||||||
if utils.compare_version('1.19', self._version) >= 0:
|
if utils.compare_version('1.19', self._version) >= 0:
|
||||||
headers['X-Registry-Config'] = auth.encode_header(
|
headers['X-Registry-Config'] = auth.encode_header(
|
||||||
self._auth_configs
|
self._auth_configs
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue