public static Image findImageByIdOrByTag ( String name , DockerClient dockerClient ) { Image image = null ; if ( ! Utils . isEmptyOrWhitespaces ( name ) ) { Logger logger = Logger . getLogger ( DockerUtils . class . getName ( ) ) ; List < Image > images = dockerClient . listImagesCmd ( ) . exec ( ) ; if ( ( image = DockerUtils . findImageById ( name , images ) ) != null ) logger . fine ( "Found a Docker image with ID " + name ) ; else if ( ( image = DockerUtils . findImageByTag ( name , images ) ) != null ) logger . fine ( "Found a Docker image with tag " + name ) ; } return image ; }
Finds an image by ID or by tag .