We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7118b1f + 8f43c03 commit f40e034Copy full SHA for f40e034
docker/utils/utils.py
@@ -120,16 +120,21 @@ def compare_version(v1, v2):
120
121
122
def ping_registry(url):
123
- return ping(url + '/v2/') or ping(url + '/v1/_ping')
+ return ping(url + '/v2/', [401]) or ping(url + '/v1/_ping')
124
125
126
-def ping(url):
+def ping(url, valid_4xx_statuses=None):
127
try:
128
res = requests.get(url, timeout=3)
129
except Exception:
130
return False
131
else:
132
- return res.status_code < 400
+ # We don't send yet auth headers
133
+ # and a v2 registry will respond with status 401
134
+ return (
135
+ res.status_code < 400 or
136
+ (valid_4xx_statuses and res.status_code in valid_4xx_statuses)
137
+ )
138
139
140
def _convert_port_binding(binding):
0 commit comments