inspects envOverride images =
  do maybeInspectOut <-
       try (readDockerProcess envOverride Nothing ("inspect" : images))
     case maybeInspectOut of
       Right inspectOut ->
         -- filtering with 'isAscii' to workaround @docker inspect@ output containing invalid UTF-8
         case eitherDecode (LBS.pack (filter isAscii (decodeUtf8 inspectOut))) of
           Left msg -> throwM (InvalidInspectOutputException msg)
           Right results -> return (Map.fromList (map (\r -> (iiId r,r)) results))
       Left (ProcessFailed _ _ _ err)
         | "Error: No such image" `LBS.isPrefixOf` err -> return Map.empty
       Left e -> throwM e

-- | Pull latest version of configured Docker image from registry.
inspects envOverride images =
  do maybeInspectOut <-
       try (readDockerProcess envOverride Nothing ("inspect" : images))
     case maybeInspectOut of
       Right inspectOut ->
         -- filtering with 'isAscii' to workaround @docker inspect@ output containing invalid UTF-8
         case eitherDecode (LBS.pack (filter isAscii (decodeUtf8 inspectOut))) of
           Left msg -> throwM (InvalidInspectOutputException msg)
           Right results -> return (Map.fromList (map (\r -> (iiId r,r)) results))
       Left (ProcessFailed _ _ _ err)
         | "Error: No such image" `LBS.isPrefixOf` err -> return Map.empty
       Left e -> throwM e

-- | Pull latest version of configured Docker image from registry.
inspects envOverride images =
  do maybeInspectOut <-
       try (readDockerProcess envOverride Nothing ("inspect" : images))
     case maybeInspectOut of
       Right inspectOut ->
         -- filtering with 'isAscii' to workaround @docker inspect@ output containing invalid UTF-8
         case eitherDecode (LBS.pack (filter isAscii (decodeUtf8 inspectOut))) of
           Left msg -> throwM (InvalidInspectOutputException msg)
           Right results -> return (Map.fromList (map (\r -> (iiId r,r)) results))
       Left (ProcessFailed _ _ _ err)
         | "Error: No such image" `LBS.isPrefixOf` err -> return Map.empty
       Left e -> throwM e

-- | Pull latest version of configured Docker image from registry.