Merge pull request #308 from vieux/filter_swarm_containers

Proposal: require ps -a to show swarm containers
This commit is contained in:
Andrea Luzzardi 2015-02-02 18:32:12 -08:00
commit 2b2114e554
2 changed files with 9 additions and 2 deletions

View File

@ -49,6 +49,9 @@ DELETE "/images/{name:.*}"
```
* `GET "/containers/{name:.*}/json"`: `HostIP` replaced by the the actual Node's IP if `HostIP` is `0.0.0.0`
* `GET "/containers"/json"`: Node's name prepended to the container name.
* `GET "/containers/json"`: Node's name prepended to the container name.
* `GET "/containers/json"`: `HostIP` replaced by the the actual Node's IP if `HostIP` is `0.0.0.0`
* `GET "/containers/json"` : Containers started from the `swarm` official image are hidden by default, use `all=1` to display them.
* `GET "/containers"/json"`: `HostIP` replaed by the the actual Node's IP if `HostIP` is `0.0.0.0`

View File

@ -136,6 +136,10 @@ func getContainersJSON(c *context, w http.ResponseWriter, r *http.Request) {
if !strings.Contains(tmp.Status, "Up") && !all {
continue
}
// Skip swarm containers unless -a was specified.
if strings.Split(tmp.Image, ":")[0] == "swarm" && !all {
continue
}
if !container.Node.IsHealthy() {
tmp.Status = "Pending"
}