Class ContainerTracker


  • public class ContainerTracker
    extends Object
    Tracker class for tracking started containers so that they can be shut down at the end when docker:start and docker:stop are used in the same run
    • Constructor Detail

      • ContainerTracker

        public ContainerTracker()
    • Method Detail

      • registerContainer

        public void registerContainer​(String containerId,
                                      ImageConfiguration imageConfig,
                                      GavLabel gavLabel)
        Register a started container to this tracker
        Parameters:
        containerId - container id to register
        imageConfig - configuration of associated image
        gavLabel - pom label to identifying the reactor project where the container was created
      • removeContainer

        public io.fabric8.maven.docker.service.ContainerTracker.ContainerShutdownDescriptor removeContainer​(String containerId)
        Remove a container from this container (if stored) and return its descriptor
        Parameters:
        containerId - id to remove
        Returns:
        descriptor of the container removed or null
      • lookupContainer

        public String lookupContainer​(String lookup)
        Lookup a container by name or alias from the tracked containers
        Parameters:
        lookup - name or alias of the container to lookup
        Returns:
        container id found or null
      • removeShutdownDescriptors

        public Collection<io.fabric8.maven.docker.service.ContainerTracker.ContainerShutdownDescriptor> removeShutdownDescriptors​(GavLabel gavLabel)
        Get all shutdown descriptors for a given pom label and remove it from the tracker. The descriptors are returned in reverse order of their registration. If no pom label is given, then all descriptors are returned.
        Parameters:
        gavLabel - the label for which to get the descriptors or null for all descriptors
        Returns:
        the descriptors for the given label or an empty collection
      • getShutdownDescriptors

        public List<io.fabric8.maven.docker.service.ContainerTracker.ContainerShutdownDescriptor> getShutdownDescriptors​(GavLabel gavLabel)
        Get all shutdown descriptors for a given pom label. The descriptors are returned in order of their registration. If no pom label is given, then all descriptors are returned.
        Parameters:
        gavLabel - the label for which to get the descriptors or null for all descriptors
        Returns:
        the descriptors for the given label or an empty collection