mirror of https://github.com/docker/docs.git
Host Down containers in ps requires -a
Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
parent
1fa6cd9c55
commit
aa028f4d09
|
@ -327,8 +327,8 @@ func getContainersJSON(c *context, w http.ResponseWriter, r *http.Request) {
|
|||
// Filtering: select the containers we want to return.
|
||||
candidates := []*cluster.Container{}
|
||||
for _, container := range c.cluster.Containers() {
|
||||
// Skip stopped containers unless -a was specified.
|
||||
if !container.Info.State.Running && !all && before == nil && limit <= 0 {
|
||||
// Skip stopped containers unless -a was specified
|
||||
if (!container.Info.State.Running || !container.Engine.IsHealthy()) && !all && before == nil && limit <= 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,30 @@ function teardown() {
|
|||
stop_docker
|
||||
}
|
||||
|
||||
@test "docker ps - host down" {
|
||||
start_docker_with_busybox 2
|
||||
swarm_manage --engine-refresh-min-interval=1s --engine-refresh-max-interval=1s --engine-failure-retry=1 ${HOSTS[0]},${HOSTS[1]}
|
||||
|
||||
docker_swarm run -d -e constraint:node==node-0 busybox sleep 42
|
||||
docker_swarm run -d -e constraint:node==node-1 busybox sleep 42
|
||||
|
||||
run docker_swarm ps
|
||||
[ "${#lines[@]}" -eq 3 ]
|
||||
|
||||
# Stop node-0
|
||||
docker_host stop ${DOCKER_CONTAINERS[0]}
|
||||
|
||||
# Wait for Swarm to detect the node failure.
|
||||
retry 5 1 eval "docker_swarm info | grep -q 'Unhealthy'"
|
||||
|
||||
run docker_swarm ps
|
||||
# container with host down shouldn't be displyed since they are not `running`
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
|
||||
run docker_swarm ps -a
|
||||
[ "${#lines[@]}" -eq 3 ]
|
||||
}
|
||||
|
||||
@test "docker ps -n" {
|
||||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
|
|
Loading…
Reference in New Issue