dockerClient .pullImageCmd(imageName.getUnversionedPart()) .withTag(imageName.getVersionPart()) .exec(callback); callback.awaitCompletion();
public void pullImage(String imageName) { this.readWriteLock.readLock().lock(); try { final Image image = Image.valueOf(imageName); PullImageCmd pullImageCmd = this.dockerClient.pullImageCmd(image.getName()); String tag = image.getTag(); if (tag != null && !"".equals(tag)) { pullImageCmd.withTag(tag); } else { pullImageCmd.withTag("latest"); } pullImageCmd.exec(new PullImageResultCallback()).awaitSuccess(); } finally { this.readWriteLock.readLock().unlock(); } }
public void pullImage(String imageName) { this.readWriteLock.readLock().lock(); try { final Image image = Image.valueOf(imageName); PullImageCmd pullImageCmd = this.dockerClient.pullImageCmd(image.getName()); String tag = image.getTag(); if (tag != null && !"".equals(tag)) { pullImageCmd.withTag(tag); } else { pullImageCmd.withTag("latest"); } pullImageCmd.exec(new PullImageResultCallback()).awaitSuccess(); } finally { this.readWriteLock.readLock().unlock(); } }
private void pullImageIfNeeded() { final List<Image> images = client.listImagesCmd().withImageNameFilter(image).exec(); if (images.isEmpty()) { log.info("Pulling " + image); final String[] parts = image.split(":"); client.pullImageCmd(parts[0]).withTag(parts[1]).exec(new PullImageResultCallback()).awaitSuccess(); log.info(image + " pulled"); } }
dockerClient.pullImageCmd(imageName.getUnversionedPart()).withTag(imageName.getVersionPart()).exec(callback); callback.awaitCompletion(); AVAILABLE_IMAGE_NAME_CACHE.add(imageName);
/** * Pulls a Docker image with given name and version. Throws exception when it times out after given timeout. * * @param imageName image to pull * @param imageVersion image version to pull * @param timeoutSecs pulling timeout in seconds */ public static void pullImage(String imageName, String imageVersion, long timeoutSecs) { try { final CompletableFuture<Void> result = new CompletableFuture<>(); DockerClientFactory.build().pullImageCmd(imageName).withTag(imageVersion).exec(new PullImageResultCallback()).awaitCompletion(); } catch (InterruptedException | RuntimeException e) { throw new MinimesosException("Error pulling image or image not found in registry: " + imageName + ":" + imageVersion, e); } }
/** * Produces a pull image request * * @param client * @param message * @return */ private PullImageCmd executePullImageRequest(DockerClient client, Message message) { LOGGER.debug("Executing Docker Pull Image Request"); String repository = DockerHelper.getProperty(DockerConstants.DOCKER_REPOSITORY, configuration, message, String.class); ObjectHelper.notNull(repository, "Repository must be specified"); PullImageCmd pullImageCmd = client.pullImageCmd(repository); String registry = DockerHelper.getProperty(DockerConstants.DOCKER_REGISTRY, configuration, message, String.class); if (registry != null) { pullImageCmd.withRegistry(registry); } String tag = DockerHelper.getProperty(DockerConstants.DOCKER_TAG, configuration, message, String.class); if (tag != null) { pullImageCmd.withTag(tag); } AuthConfig authConfig = client.authConfig(); if (authConfig != null) { pullImageCmd.withAuthConfig(authConfig); } return pullImageCmd; }
log.info("Pulling image " + imageId, context); try { connection.getDockerClient().pullImageCmd(imageId).withTag(tag).exec(new PullImageResultCallback()).awaitCompletion(); } catch (InterruptedException e) { throw new InvalidOperationExecutionException("Pull interrupted", e);
); if (tag != null) req.withTag(tag); PullImageResultCallback res = new PullImageResultCallback(); res = req.exec(res);