diff options
author | Justin Michalicek <jmichalicek@gmail.com> | 2016-07-06 16:10:16 -0400 |
---|---|---|
committer | Justin Michalicek <jmichalicek@gmail.com> | 2016-07-12 10:06:34 -0400 |
commit | 66e7af93532890dcb8e43d8a701ca3b3eae51d4e (patch) | |
tree | d319d3795429fcc8b2ba15f64e79c5f699e91e21 | |
parent | 5e47026a9beefaccbb845df4ce00ae8a684f0de6 (diff) | |
download | docker-py-66e7af93532890dcb8e43d8a701ca3b3eae51d4e.tar.gz |
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>
-rw-r--r-- | docker/api/build.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/docker/api/build.py b/docker/api/build.py index 971a50e..7403716 100644 --- a/docker/api/build.py +++ b/docker/api/build.py @@ -18,7 +18,8 @@ class BuildApiMixin(object): custom_context=False, encoding=None, pull=False, forcerm=False, dockerfile=None, container_limits=None, decode=False, buildargs=None, gzip=False): - remote = context = headers = None + remote = context = None + headers = {} container_limits = container_limits or {} if path is None and fileobj is None: 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()) ) ) - if headers is None: - headers = {} + if utils.compare_version('1.19', self._version) >= 0: headers['X-Registry-Config'] = auth.encode_header( self._auth_configs |