public static DockerClient createDockerClient ( Map < String , String > targetProperties ) throws TargetException { // Validate what needs to be validated. Logger logger = Logger . getLogger ( DockerHandler . class . getName ( ) ) ; logger . fine ( "Setting the target properties." ) ; String edpt = targetProperties . get ( DockerHandler . ENDPOINT ) ; if ( Utils . isEmptyOrWhitespaces ( edpt ) ) edpt = DockerHandler . DEFAULT_ENDPOINT ; // The configuration is straight-forward. Builder config = DefaultDockerClientConfig . createDefaultConfigBuilder ( ) . withDockerHost ( edpt ) . withRegistryUsername ( targetProperties . get ( DockerHandler . USER ) ) . withRegistryPassword ( targetProperties . get ( DockerHandler . PASSWORD ) ) . withRegistryEmail ( targetProperties . get ( DockerHandler . EMAIL ) ) . withApiVersion ( targetProperties . get ( DockerHandler . VERSION ) ) ; // Build the client. DockerClientBuilder clientBuilder = DockerClientBuilder . getInstance ( config . build ( ) ) ; return clientBuilder . build ( ) ; }
Creates a Docker client from target properties .