@Test public void testBuildContainerNameFrom() { Assert.assertEquals( "vm_from_app", DockerUtils.buildContainerNameFrom( "vm", "app" )); Assert.assertEquals( "vm_from_app", DockerUtils.buildContainerNameFrom( "/vm", "app" )); Assert.assertEquals( "vm-pop_from_app", DockerUtils.buildContainerNameFrom( "/vm/pop", "app" )); String scopedInstancePath = StringUtils.repeat( "a", 80 ); String name = DockerUtils.buildContainerNameFrom( scopedInstancePath, "app" ); Assert.assertEquals( 61, name.length()); Assert.assertTrue( name.matches( "^a{61}$" )); }
public static String buildContainerNameFrom( String scopedInstancePath, String applicationName ) { String containerName = scopedInstancePath + "_from_" + applicationName; containerName = containerName.replaceFirst( "^/", "" ).replace( "/", "-" ).replaceAll( "\\s+", "_" ); if( containerName.length() > 61 ) containerName = containerName.substring( 0, 61 ); return containerName; }
DockerUtils { public static String buildContainerNameFrom( String scopedInstancePath, String applicationName ) { String containerName = scopedInstancePath + "_from_" + applicationName; containerName = containerName.replaceFirst( "^/", "" ).replace( "/", "-" ).replaceAll( "\\s+", "_" ); if( containerName.length() > 61 ) containerName = containerName.substring( 0, 61 ); return containerName; } }
DockerUtils { public static String buildContainerNameFrom( String scopedInstancePath, String applicationName ) { String containerName = scopedInstancePath + "_from_" + applicationName; containerName = containerName.replaceFirst( "^/", "" ).replace( "/", "-" ).replaceAll( "\\s+", "_" ); if( containerName.length() > 61 ) containerName = containerName.substring( 0, 61 ); return containerName; } private  DockerUtils(); }
DockerUtils { public static String buildContainerNameFrom( String scopedInstancePath, String applicationName ) { String containerName = scopedInstancePath + "_from_" + applicationName; containerName = containerName.replaceFirst( "^/", "" ).replace( "/", "-" ).replaceAll( "\\s+", "_" ); if( containerName.length() > 61 ) containerName = containerName.substring( 0, 61 ); return containerName; } private  DockerUtils(); static DockerClient createDockerClient( Map<String,String> targetProperties ); static void deleteImageIfItExists( String imageId, DockerClient dockerClient ); static Image findImageByIdOrByTag( String name, DockerClient dockerClient ); static Image findImageById( String imageId, List<Image> images ); static Image findImageByTag( String imageTag, List<Image> images ); static Container findContainerByIdOrByName( String name, DockerClient dockerClient ); static ContainerState getContainerState( String containerId, DockerClient dockerClient ); static void configureOptions( Map<String,String> options, CreateContainerCmd cmd ); static Object prepareParameter( String rawValue, Class<?> clazz ); static boolean extractBoolean( Boolean bool ); static String findDefaultImageVersion( String rawVersion ); static String buildContainerNameFrom( String scopedInstancePath, String applicationName ); }
DockerUtils { public static String buildContainerNameFrom( String scopedInstancePath, String applicationName ) { String containerName = scopedInstancePath + "_from_" + applicationName; containerName = containerName.replaceFirst( "^/", "" ).replace( "/", "-" ).replaceAll( "\\s+", "_" ); if( containerName.length() > 61 ) containerName = containerName.substring( 0, 61 ); return containerName; } private  DockerUtils(); static DockerClient createDockerClient( Map<String,String> targetProperties ); static void deleteImageIfItExists( String imageId, DockerClient dockerClient ); static Image findImageByIdOrByTag( String name, DockerClient dockerClient ); static Image findImageById( String imageId, List<Image> images ); static Image findImageByTag( String imageTag, List<Image> images ); static Container findContainerByIdOrByName( String name, DockerClient dockerClient ); static ContainerState getContainerState( String containerId, DockerClient dockerClient ); static void configureOptions( Map<String,String> options, CreateContainerCmd cmd ); static Object prepareParameter( String rawValue, Class<?> clazz ); static boolean extractBoolean( Boolean bool ); static String findDefaultImageVersion( String rawVersion ); static String buildContainerNameFrom( String scopedInstancePath, String applicationName ); static final String LATEST; }