本文整理汇总了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();
}
示例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);
}
}
示例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();
}
示例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;
}
示例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;
}