use of io.fabric8.maven.docker.service.RunService.ContainerDescriptor 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;
}
use of io.fabric8.maven.docker.service.RunService.ContainerDescriptor in project docker-maven-plugin by fabric8io.
the class CopyMojo method copyFromStartedContainers.
private void copyFromStartedContainers(DockerAccess dockerAccess, RunService runService, ArchiveService archiveService, GavLabel gavLabel) throws IOException, MojoExecutionException {
List<ContainerDescriptor> containerDescriptors = runService.getContainers(gavLabel);
for (ContainerDescriptor containerDescriptor : containerDescriptors) {
ImageConfiguration imageConfiguration = containerDescriptor.getImageConfig();
CopyConfiguration copyConfiguration = imageConfiguration.getCopyConfiguration();
String imageName = imageConfiguration.getName();
if (isEmpty(copyConfiguration)) {
log.debug("Copy configuration is not defined for %s image, skipping coping", imageName);
continue;
}
String containerId = containerDescriptor.getContainerId();
log.debug("Found %s container of %s image started by start mojo", containerId, imageName);
copy(dockerAccess, archiveService, containerId, imageName, copyConfiguration);
}
}
Aggregations