本文整理汇总了Java中com.spotify.docker.client.messages.Image.repoTags方法的典型用法代码示例。如果您正苦于以下问题:Java Image.repoTags方法的具体用法?Java Image.repoTags怎么用?Java Image.repoTags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.spotify.docker.client.messages.Image
的用法示例。
在下文中一共展示了Image.repoTags方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pullImageIfNeeded
import com.spotify.docker.client.messages.Image; //导入方法依赖的package包/类
/**
* Pulls the image with the given name if it does not appear in the list of
* available images.
*
* @param imageName
* the name of the image that should be pulled
*/
@SuppressWarnings("unused")
private void pullImageIfNeeded(String imageName) {
// do not pull if env var is set to false
if (!DOCKER_AUTOPULL) {
return;
}
if (!containsVersionTag(imageName)) {
imageName += ":latest";
}
// check if image is already available
try {
List<Image> images = dockerClient.listImages();
for (Image image : images) {
if (image.repoTags() != null) {
for (String tag : image.repoTags()) {
if (tag.equals(imageName)) {
return;
}
}
}
}
// pull image and wait for the pull to finish
pullImage(imageName);
} catch (Exception e) {
LOGGER.error("Exception while pulling the image \"" + imageName + "\". " + e.getClass().getName() + ": "
+ e.getLocalizedMessage());
}
}
示例2: findImageWithTag
import com.spotify.docker.client.messages.Image; //导入方法依赖的package包/类
protected boolean findImageWithTag(final String id, final List<Image> images) {
if (images != null) {
for (Image image : images) {
if (image.repoTags() != null) {
for (String tag : image.repoTags()) {
if (tag.contains(id)) {
return true;
}
}
}
}
}
return false;
}
示例3: imageAvaliable
import com.spotify.docker.client.messages.Image; //导入方法依赖的package包/类
private boolean imageAvaliable(DockerClient dockerClient, String imageName) throws DockerException, InterruptedException {
String imageNameWithTag = imageNameWithTag(imageName);
List<Image> listImages = dockerClient.listImages(ListImagesParam.danglingImages(false));
for (Image image : listImages) {
if (image.repoTags() != null && image.repoTags().contains(imageNameWithTag)) {
log.debug("image '{}' found", imageNameWithTag);
return true;
}
}
log.debug("image '{}' not found", imageNameWithTag);
return false;
}
示例4: imageAvaliable
import com.spotify.docker.client.messages.Image; //导入方法依赖的package包/类
private boolean imageAvaliable(DockerClient dockerClient, String imageNameWithTag) throws DockerException, InterruptedException {
List<Image> listImages = dockerClient.listImages(ListImagesParam.danglingImages(false));
for (Image image : listImages) {
if (image.repoTags() != null && image.repoTags().contains(imageNameWithTag)) {
return true;
}
}
return false;
}