當前位置: 首頁>>代碼示例>>Java>>正文


Java DockerClient.listImages方法代碼示例

本文整理匯總了Java中com.spotify.docker.client.DockerClient.listImages方法的典型用法代碼示例。如果您正苦於以下問題:Java DockerClient.listImages方法的具體用法?Java DockerClient.listImages怎麽用?Java DockerClient.listImages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.spotify.docker.client.DockerClient的用法示例。


在下文中一共展示了DockerClient.listImages方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: PostgresContainer

import com.spotify.docker.client.DockerClient; //導入方法依賴的package包/類
public  PostgresContainer(DockerClient docker, String host) throws InterruptedException, IOException, ClassNotFoundException, DockerException {
    Class.forName("org.postgresql.Driver");

    this.docker = docker;
    this.host = host;

    failsafeDockerPull(docker, GOVUK_POSTGRES_IMAGE);
    docker.listImages(DockerClient.ListImagesParam.create("name", GOVUK_POSTGRES_IMAGE));

    final HostConfig hostConfig = HostConfig.builder().logConfig(LogConfig.create("json-file")).publishAllPorts(true).build();
    ContainerConfig containerConfig = ContainerConfig.builder()
            .image(GOVUK_POSTGRES_IMAGE)
            .hostConfig(hostConfig)
            .env("POSTGRES_USER=" + DB_USERNAME, "POSTGRES_PASSWORD=" + DB_PASSWORD)
            .build();
    containerId = docker.createContainer(containerConfig).id();
    docker.startContainer(containerId);
    port = hostPortNumber(docker.inspectContainer(containerId));
    registerShutdownHook();
    waitForPostgresToStart();
}
 
開發者ID:alphagov,項目名稱:pay-adminusers,代碼行數:22,代碼來源:PostgresContainer.java

示例2: predownloadImagesIfRequired

import com.spotify.docker.client.DockerClient; //導入方法依賴的package包/類
private static void predownloadImagesIfRequired() throws DockerException, InterruptedException {

        DockerClient client = getClient();
        LOG.warning("Commencing download of images.");
        Collection<MappingInfo> images = getInstance().getMapping().values();

        ProgressHandler handler = new LoggingBuildHandler();
        for (MappingInfo image : images) {
            List<Image> foundImages = client.listImages(DockerClient.ListImagesParam.byName(image.getTarget()));
            if (! foundImages.isEmpty()) {
                LOG.warning(String.format("Skipping download for Image [%s] because it's already available.",
                    image.getTarget()));
                continue;
            }
            client.pull(image.getTarget(), handler);
        }
    }
 
開發者ID:RationaleEmotions,項目名稱:just-ask,代碼行數:18,代碼來源:DockerHelper.java

示例3: PostgresContainer

import com.spotify.docker.client.DockerClient; //導入方法依賴的package包/類
public PostgresContainer(DockerClient docker, String host) throws InterruptedException, IOException, ClassNotFoundException, DockerException {
    Class.forName("org.postgresql.Driver");

    this.docker = docker;
    this.host = host;

    failsafeDockerPull(docker, GOVUK_POSTGRES_IMAGE);
    docker.listImages(DockerClient.ListImagesParam.create("name", GOVUK_POSTGRES_IMAGE));

    final HostConfig hostConfig = HostConfig.builder().logConfig(LogConfig.create("json-file")).publishAllPorts(true).build();
    ContainerConfig containerConfig = ContainerConfig.builder()
            .image(GOVUK_POSTGRES_IMAGE)
            .hostConfig(hostConfig)
            .env("POSTGRES_USER=" + DB_USERNAME, "POSTGRES_PASSWORD=" + DB_PASSWORD)
            .build();
    containerId = docker.createContainer(containerConfig).id();
    docker.startContainer(containerId);
    port = hostPortNumber(docker.inspectContainer(containerId));
    registerShutdownHook();
    waitForPostgresToStart();
}
 
開發者ID:alphagov,項目名稱:pay-publicauth,代碼行數:22,代碼來源:PostgresContainer.java

示例4: imageAvaliable

import com.spotify.docker.client.DockerClient; //導入方法依賴的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

示例5: imageAvaliable

import com.spotify.docker.client.DockerClient; //導入方法依賴的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


注:本文中的com.spotify.docker.client.DockerClient.listImages方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。