Search in sources :

Example 1 with ContainerShutdownDescriptor

use of io.fabric8.maven.docker.service.ContainerTracker.ContainerShutdownDescriptor in project docker-maven-plugin by fabric8io.

the class RunService method getContainers.

/**
 * Get all started containers.
 * The containers are returned in order of their registration.
 * If no pom label is given, then all containers are returned.
 *
 * @param gavLabel the label for which to get the containers or <code>null</code> for all containers
 * @return the containers for the given label or an empty collection
 */
public List<ContainerDescriptor> getContainers(GavLabel gavLabel) {
    Collection<ContainerShutdownDescriptor> shutdownDescriptors = tracker.getShutdownDescriptors(gavLabel);
    List<ContainerDescriptor> containers = new ArrayList<>(shutdownDescriptors.size());
    for (ContainerShutdownDescriptor descriptor : shutdownDescriptors) {
        containers.add(new ContainerDescriptor(descriptor.getContainerId(), descriptor.getImageConfiguration()));
    }
    return containers;
}
Also used : ContainerShutdownDescriptor(io.fabric8.maven.docker.service.ContainerTracker.ContainerShutdownDescriptor) ArrayList(java.util.ArrayList)

Aggregations

ContainerShutdownDescriptor (io.fabric8.maven.docker.service.ContainerTracker.ContainerShutdownDescriptor)1 ArrayList (java.util.ArrayList)1