public class DockerStatus extends Object
In docker-java version 2.2.0, which we're using, only these fields are available in the container state returned from Docker Inspect: "isRunning", "isPaused", "startedAt", and "finishedAt". There are states that can occur (including "created", "OOMkilled" and "dead") that aren't directly shown through this result.
Docker also doesn't seem to use null values for timestamps; see DOCKER_TIMESTAMP_ZERO, below.
Constructor and Description |
---|
DockerStatus() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isContainerExitCodeSuccess(com.github.dockerjava.api.command.InspectContainerResponse.ContainerState state) |
static boolean |
isContainerRunning(com.github.dockerjava.api.command.InspectContainerResponse.ContainerState state,
Duration minimumRunningDuration,
Instant now)
Based on this status, is this container running, and has it been doing so for the specified amount of time?
|
static boolean |
isContainerStopped(com.github.dockerjava.api.command.InspectContainerResponse.ContainerState state)
Based on this status, has the container halted?
|
static boolean |
isDockerTimestampNonEmpty(String dockerTimestamp) |
public static boolean isContainerRunning(com.github.dockerjava.api.command.InspectContainerResponse.ContainerState state, Duration minimumRunningDuration, Instant now)
state
- the state provided by InspectContainerminimumRunningDuration
- minimum duration to consider this as "solidly" running, or nullnow
- the time to consider as the current timepublic static boolean isContainerStopped(com.github.dockerjava.api.command.InspectContainerResponse.ContainerState state)
state
- the state provided by InspectContainerpublic static boolean isDockerTimestampNonEmpty(String dockerTimestamp)
public static boolean isContainerExitCodeSuccess(com.github.dockerjava.api.command.InspectContainerResponse.ContainerState state)
Copyright © 2017. All rights reserved.