diff --git a/docker/auth/auth.py b/docker/auth/auth.py index 56c42ecacd..4af741e072 100644 --- a/docker/auth/auth.py +++ b/docker/auth/auth.py @@ -98,12 +98,6 @@ def encode_header(auth): return base64.b64encode(auth_json) -def encode_full_header(auth): - """ Returns the given auth block encoded for the X-Registry-Config header. - """ - return encode_header({'configs': auth}) - - def parse_auth(entries): """ Parses authentication entries diff --git a/docker/client.py b/docker/client.py index 9084689594..41dd03aee2 100644 --- a/docker/client.py +++ b/docker/client.py @@ -140,9 +140,14 @@ def build(self, path=None, tag=None, quiet=False, fileobj=None, if self._auth_configs: if headers is None: headers = {} - headers['X-Registry-Config'] = auth.encode_full_header( - self._auth_configs - ) + if utils.compare_version('1.19', self._version) >= 0: + headers['X-Registry-Config'] = auth.encode_header( + self._auth_configs + ) + else: + headers['X-Registry-Config'] = auth.encode_header({ + 'configs': self._auth_configs + }) response = self._post( u,