Skip to content

Commit

Permalink
Add #86 to changelog and fine tuned a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhuss committed Feb 10, 2015
1 parent d521630 commit dd0b666
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion doc/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
- "Entrypoint" supports now arguments (#84)
- Fix basedir for multi module projects (#89)
- Pull base images before building when "autoPull" is switched on (#76, #77, #88)

- Fix for stopping containers without tag (#86)

* **0.11.0**
- Add support for binding/exporting containers during startup (#55)
- Provide better control of the build assembly configuration. In addition, the plugin will now search
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,21 +159,24 @@ public String getNewestImageForContainer(String image) throws DockerAccessExcept
}

private List<String> getContainerIds(String image,boolean onlyLatest) throws DockerAccessException {
if (!image.contains(":")) {
image = image + ":latest";
}

List<String> ret = new ArrayList<>();
ImageName imageName = new ImageName(image);
String imageFullName = imageName.getFullNameWithTag();

HttpUriRequest req = newGet(baseUrl + "/containers/json?limit=100");
HttpResponse resp = request(req);
checkReturnCode("Fetching container information", resp, 200);
JSONArray configs = asJsonArray(resp);
return extractMatchingContainers(onlyLatest, imageFullName, configs);
}

private List<String> extractMatchingContainers(boolean onlyLatest, String imageFullName, JSONArray configs) {
long newest = 0;
List<String> ret = new ArrayList<>();
for (int i = 0; i < configs.length(); i ++) {
JSONObject config = configs.getJSONObject(i);
String containerImage = config.getString("Image");

if (image.equals(containerImage)) {
if (imageFullName.equals(containerImage)) {
String id = config.getString("Id");
if (!onlyLatest) {
ret.add(id);
Expand Down

0 comments on commit dd0b666

Please sign in to comment.