Skip to content

Commit 4be2286

Browse files
committed
Make build auth work with API versions < 1.19 too
1 parent 7430eb8 commit 4be2286

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

docker/client.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,14 @@ def build(self, path=None, tag=None, quiet=False, fileobj=None,
140140
if self._auth_configs:
141141
if headers is None:
142142
headers = {}
143-
headers['X-Registry-Config'] = auth.encode_header(
144-
self._auth_configs
145-
)
143+
if utils.compare_version('1.19', self._version) >= 0:
144+
headers['X-Registry-Config'] = auth.encode_header(
145+
self._auth_configs
146+
)
147+
else:
148+
headers['X-Registry-Config'] = auth.encode_header({
149+
'configs': self._auth_configs
150+
})
146151

147152
response = self._post(
148153
u,

0 commit comments

Comments
 (0)