diff --git a/docker/utils/utils.py b/docker/utils/utils.py
index <HASH>..<HASH> 100644
--- a/docker/utils/utils.py
+++ b/docker/utils/utils.py
@@ -57,9 +57,10 @@ def compare_version(v1, v2):
 def ping(url):
     try:
         res = requests.get(url)
-        return res.status >= 400
     except Exception:
         return False
+    else:
+        return res.status_code >= 400
 
 
 def _convert_port_binding(binding):
replace status with status_code as defined by requests API

Move this statement in `else` clause to make sure the try except block doesn't catch
coding errors.