diff --git a/docker.cabal b/docker.cabal
--- a/docker.cabal
+++ b/docker.cabal
@@ -1,5 +1,5 @@
 name:                docker
-version:             0.4.0.1
+version:             0.4.0.2
 synopsis:            An API client for docker written in Haskell
 description:         See API documentation below.
 homepage:            https://github.com/denibertovic/docker-hs
@@ -15,17 +15,17 @@
 stability:           experimental
 
 library
-  default-extensions:          DeriveGeneric, OverloadedStrings, ScopedTypeVariables, ExplicitForAll, MultiParamTypeClasses, FlexibleContexts, GeneralizedNewtypeDeriving, RankNTypes, DeriveFunctor, FlexibleInstances
+  default-extensions:          DeriveGeneric, OverloadedStrings, ScopedTypeVariables, ExplicitForAll, MultiParamTypeClasses, FlexibleContexts, GeneralizedNewtypeDeriving, RankNTypes, DeriveFunctor, FlexibleInstances, CPP
   hs-source-dirs:      src
   exposed-modules:     Docker.Client, Docker.Client.Api, Docker.Client.Types, Docker.Client.Internal, Docker.Client.Http, Docker.Client.Utils
   -- other-modules:       Docker.Internal
   build-depends:       base >= 4.7 && < 5
-                     , aeson >= 0.9.0 && < 1.1.0
+                     , aeson >= 0.9.0 && < 1.2.0
                      , blaze-builder >= 0.4.0 && < 0.5.0
                      , bytestring >= 0.10.0 && < 0.11.0
                      , containers >= 0.5.0 && < 0.6.0
                      , data-default-class >= 0.0.1 && < 0.2.0
-                     , http-client >= 0.4.0 && < 0.5.0
+                     , http-client >= 0.4.0 && < 0.6.0
                      , http-types >= 0.9 && < 0.10.0
                      , vector
                      , conduit
@@ -51,9 +51,9 @@
                      , scientific >= 0.3.0 && < 0.4.0
                      , tls >= 1.3.7 && < 1.4.0
                      , unordered-containers >= 0.2.0 && < 0.3.0
-                     , x509 >= 1.6.0 && < 1.7.0
-                     , x509-store >= 1.6.0 && < 1.7.0
-                     , x509-system >= 1.6.0 && < 1.7.0
+                     , x509 >= 1.6.0 && < 1.8.0
+                     , x509-store >= 1.6.0 && < 1.8.0
+                     , x509-system >= 1.6.0 && < 1.8.0
   default-language:    Haskell2010
   ghc-options:         -Wall -fno-warn-name-shadowing
 
diff --git a/src/Docker/Client/Http.hs b/src/Docker/Client/Http.hs
--- a/src/Docker/Client/Http.hs
+++ b/src/Docker/Client/Http.hs
@@ -114,8 +114,12 @@
     let request = NHS.setRequestManager manager request'
     try (NHS.httpSink request sink) >>= \res -> case res of
         Right res                              -> return res
+#if MIN_VERSION_http_client(0,5,0)
+        Left e@(HTTP.HttpExceptionRequest _ HTTP.ConnectionFailure{})  -> return $ Left $ DockerConnectionError e
+#else
         Left e@HTTP.FailedConnectionException{}  -> return $ Left $ DockerConnectionError e
         Left e@HTTP.FailedConnectionException2{} -> return $ Left $ DockerConnectionError e
+#endif
         Left e                                 -> return $ Left $ GenericDockerError (T.pack $ show e)
 
 -- | Connect to a unix domain socket (the default docker socket is
