• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Image类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.spotify.docker.client.messages.Image的典型用法代码示例。如果您正苦于以下问题:Java Image类的具体用法?Java Image怎么用?Java Image使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Image类属于com.spotify.docker.client.messages包,在下文中一共展示了Image类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: listImageTags

import com.spotify.docker.client.messages.Image; //导入依赖的package包/类
@Override
public Set<String> listImageTags() throws IOException {

  final Set<String> result = new HashSet<>();

  try {

    for (Image image : CollectionUtils
        .nullToEmpty(this.client.listImages())) {
      for (String tag : CollectionUtils.nullToEmpty(image.repoTags())) {
        if (tag != null) {
          result.add(tag);
        }
      }
    }
  } catch (DockerException | InterruptedException e) {
    throw new IOException(e);
  }

  return result;
}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:22,代码来源:SpotifyDockerClient.java


示例2: pullImageIfNotExists

import com.spotify.docker.client.messages.Image; //导入依赖的package包/类
@Override
public void pullImageIfNotExists() throws IOException {

  try {

    for (Image image : nullToEmpty(this.dockerClient.listImages())) {
      for (String tag : nullToEmpty(image.repoTags())) {
        if (this.dockerImage.equals(tag)) {
          return;
        }
      }
    }

    getLogger().fine("Pull Docker image: " + this.dockerImage);
    this.dockerClient.pull(this.dockerImage);
  } catch (InterruptedException | DockerException e) {
    throw new IOException(e);
  }
}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:20,代码来源:SpotifyDockerImageInstance.java


示例3: start

import com.spotify.docker.client.messages.Image; //导入依赖的package包/类
@Override
public void start(WorkflowInstance workflowInstance, RunSpec runSpec) {
  final String imageTag = runSpec.imageName().contains(":")
      ? runSpec.imageName()
      : runSpec.imageName() + ":latest";

  final ContainerCreation creation;
  try {
    boolean found = false;
    for (Image image : client.listImages()) {
      found |= image.repoTags().contains(imageTag);
    }

    if (!found) {
      client.pull(imageTag, System.out::println); // blocking
    }

    final ContainerConfig containerConfig = ContainerConfig.builder()
        .image(imageTag)
        .cmd(runSpec.args())
        .build();
    creation = client.createContainer(containerConfig, runSpec.executionId());
    client.startContainer(creation.id());
  } catch (DockerException | InterruptedException e) {
    throw new RuntimeException(e);
  }

  inFlight.put(creation.id(), workflowInstance);
  LOG.info("Started container with id " + creation.id() + " and name " + runSpec.executionId());
}
 
开发者ID:spotify,项目名称:styx,代码行数:31,代码来源:LocalDockerRunner.java


示例4: 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());
    }
}
 
开发者ID:hobbit-project,项目名称:platform,代码行数:39,代码来源:ContainerManagerImpl.java


示例5: 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;
}
 
开发者ID:hobbit-project,项目名称:platform,代码行数:15,代码来源:DockerBasedTest.java


示例6: initClient

import com.spotify.docker.client.messages.Image; //导入依赖的package包/类
@Before
public void initClient() throws Exception {
    dockerClient = DefaultDockerClient.fromEnv().build();
    // check if busybox is present
    List<Image> images = dockerClient.listImages(DockerClient.ListImagesParam.allImages());
    if (!findImageWithTag(busyboxImageName, images)) {
        dockerClient.pull(busyboxImageName);
    }
}
 
开发者ID:hobbit-project,项目名称:platform,代码行数:10,代码来源:DockerBasedTest.java


示例7: 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;
}
 
开发者ID:tdomzal,项目名称:junit-docker-rule,代码行数:13,代码来源:DockerRule.java


示例8: 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;
}
 
开发者ID:tdomzal,项目名称:junit-docker-rule,代码行数:10,代码来源:DockerRuleImagePullTest.java


示例9: listImages

import com.spotify.docker.client.messages.Image; //导入依赖的package包/类
@Override
public List<Image> listImages(ListImagesParam... lips) {
    throw new IllegalStateException(DISCONNECTED); 
}
 
开发者ID:amihaiemil,项目名称:comdor,代码行数:5,代码来源:Disconnected.java



注:本文中的com.spotify.docker.client.messages.Image类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Type类代码示例发布时间:2022-05-22
下一篇:
Java IMetaPrimitive类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap