Source:
protected void pullImage(CheServiceImpl service, String machineImageName, ProgressMonitor progressMonitor) throws MachineException { DockerMachineSource dockerMachineSource = new DockerMachineSource( new MachineSourceImpl("image").setLocation(service.getImage())); if (dockerMachineSource.getRepository() == null) { throw new MachineException( format("Machine creation failed. Machine source is invalid. No repository is defined. Found '%s'.", dockerMachineSource)); } try { boolean isSnapshot = SNAPSHOT_LOCATION_PATTERN.matcher(dockerMachineSource.getLocation()).matches(); boolean isImageExistLocally = isDockerImageExistLocally(dockerMachineSource.getRepository()); if (!isSnapshot && (doForcePullImage || !isImageExistLocally) || isSnapshot && snapshotUseRegistry) { PullParams pullParams = PullParams.create(dockerMachineSource.getRepository()) .withTag(MoreObjects.firstNonNull(dockerMachineSource.getTag(), LATEST_TAG)) .withRegistry(dockerMachineSource.getRegistry()) .withAuthConfigs(dockerCredentials.getCredentials()); docker.pull(pullParams, progressMonitor); } String fullNameOfPulledImage = dockerMachineSource.getLocation(false); try { docker.tag(TagParams.create(fullNameOfPulledImage, machineImageName)); } catch (ImageNotFoundException nfEx) { throw new SourceNotFoundException(nfEx.getLocalizedMessage(), nfEx); } if (isSnapshot && snapshotUseRegistry) { docker.removeImage(RemoveImageParams.create(fullNameOfPulledImage).withForce(false)); } } catch (IOException e) { throw new MachineException("Can't create machine from image. Cause: " + e.getLocalizedMessage(), e); } }

Target:
protected void pullImage(CheServiceImpl service, String machineImageName, ProgressMonitor progressMonitor) throws MachineException { DockerMachineSource dockerMachineSource = new DockerMachineSource( new MachineSourceImpl("image").setLocation(service.getImage())); if (dockerMachineSource.getRepository() == null) { throw new MachineException( format("Machine creation failed. Machine source is invalid. No repository is defined. Found '%s'.", dockerMachineSource)); } try { boolean isSnapshot = SNAPSHOT_LOCATION_PATTERN.matcher(dockerMachineSource.getLocation()).matches(); boolean isImageExistLocally = isDockerImageExistLocally(dockerMachineSource.getRepository()); if ((!isSnapshot && (doForcePullImage || !isImageExistLocally)) || (isSnapshot && snapshotUseRegistry)) { PullParams pullParams = PullParams.create(dockerMachineSource.getRepository()) .withTag(MoreObjects.firstNonNull(dockerMachineSource.getTag(), LATEST_TAG)) .withRegistry(dockerMachineSource.getRegistry()) .withAuthConfigs(dockerCredentials.getCredentials()); docker.pull(pullParams, progressMonitor); } String fullNameOfPulledImage = dockerMachineSource.getLocation(false); try { docker.tag(TagParams.create(fullNameOfPulledImage, machineImageName)); } catch (ImageNotFoundException nfEx) { throw new SourceNotFoundException(nfEx.getLocalizedMessage(), nfEx); } if (isSnapshot && snapshotUseRegistry) { docker.removeImage(RemoveImageParams.create(fullNameOfPulledImage).withForce(false)); } } catch (IOException e) { throw new MachineException("Can't create machine from image. Cause: " + e.getLocalizedMessage(), e); } }