public static void pushImage ( String imageTag , String username , String password , String host ) throws IOException { final AuthConfig authConfig = new AuthConfig ( ) ; authConfig . withUsername ( username ) ; authConfig . withPassword ( password ) ; DockerClient dockerClient = null ; try { dockerClient = getDockerClient ( host ) ; dockerClient . pushImageCmd ( imageTag ) . withAuthConfig ( authConfig ) . exec ( new PushImageResultCallback ( ) ) . awaitSuccess ( ) ; } finally { closeQuietly ( dockerClient ) ; } }
Push docker image using the docker java client .