Class ContainerNamingUtil


  • public class ContainerNamingUtil
    extends Object
    Since:
    1.0.0
    Author:
    marcus
    • Method Detail

      • getContainersToStop

        public static Collection<Container> getContainersToStop​(ImageConfiguration image,
                                                                String defaultContainerNamePattern,
                                                                Date buildTimestamp,
                                                                Collection<Container> containers)
        Keep only the entry with the higest index if an indexed naming scheme for container has been chosen or if the container name pattern doesn't contain any index placeholders then filter containers (analog formatContainerName(ImageConfiguration, String, Date, Collection) but with stopping them in mind).

        The placeholders of the containerNamePattern are resolved as follows:
        • %a is replaced with the image alias
        • %n is replaced with the image name
        • %t is replaced with any date (regex \d{10,})
        • %i is replaced with any number (regex \d+)
        Parameters:
        image - the image from which to the the container pattern
        buildTimestamp - the timestamp for the build
        containers - the list of existing containers
        Returns:
        filtered container instances, maybe empty but never null