/** * Based on this status, has the container halted? * * @param state the state provided by InspectContainer * @return true if we can conclude that the container has started but is now stopped, false otherwise. */ public static boolean isContainerStopped(InspectContainerResponse.ContainerState state) { // get some preconditions out of the way if (state.getRunning() || state.getPaused()) { return false; } // if the finished timestamp is non-empty, that means the container started and finished. boolean hasStarted = isDockerTimestampNonEmpty(state.getStartedAt()); boolean hasFinished = isDockerTimestampNonEmpty(state.getFinishedAt()); return hasStarted && hasFinished; }
/** * Based on this status, has the container halted? * * @param state the state provided by InspectContainer * @return true if we can conclude that the container has started but is now stopped, false otherwise. */ public static boolean isContainerStopped(InspectContainerResponse.ContainerState state) { // get some preconditions out of the way if (state.getRunning() || state.getPaused()) { return false; } // if the finished timestamp is non-empty, that means the container started and finished. boolean hasStarted = isDockerTimestampNonEmpty(state.getStartedAt()); boolean hasFinished = isDockerTimestampNonEmpty(state.getFinishedAt()); return hasStarted && hasFinished; }