Skip to content

Commit

Permalink
Fix handling of missing image message with newer versions of Docker
Browse files Browse the repository at this point in the history
At some unknown version, `docker inspect` stopped outputting "Error: No such
image" and started outputting "Error: No such object:" when the image is
question was missing. That change broke detecting that situation.

This commit checks for either version of the message.
  • Loading branch information
enolan committed May 12, 2017
1 parent 0ddbaa7 commit c5cba6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ Bug fixes:
* Switching a package between extra-dep and local package now forces
rebuild (previously it wouldn't if versions were the same).
See [#2147](https://github.com/commercialhaskell/stack/issues/2147)
* Fixed an issue where Stack wouldn't detect missing Docker images properly
with newer Docker versions.


## 1.4.0
Expand Down
3 changes: 2 additions & 1 deletion src/Stack/Docker.hs
Original file line number Diff line number Diff line change
Expand Up @@ -664,8 +664,9 @@ inspects envOverride images =
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
| any (`LBS.isPrefixOf` err) missingImagePrefixes -> return Map.empty
Left e -> throwM e
where missingImagePrefixes = ["Error: No such image", "Error: No such object:"]

-- | Pull latest version of configured Docker image from registry.
pull :: (StackM env m, HasConfig env) => m ()
Expand Down

0 comments on commit c5cba6e

Please sign in to comment.