本文整理匯總了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;
}