com.github.dockerjava.api.model.Info Java Examples
The following examples show how to use
com.github.dockerjava.api.model.Info.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LeaveSwarmCmdExecIT.java From docker-java with Apache License 2.0 | 6 votes |
@Test public void leaveSwarmAsMaster() throws DockerException { DockerClient dockerClient = startSwarm(); Info info = dockerClient.infoCmd().exec(); LOG.info("Inspected docker: {}", info.toString()); assertThat(info.getSwarm().getLocalNodeState(), is(LocalNodeState.ACTIVE)); dockerClient.leaveSwarmCmd() .withForceEnabled(true) .exec(); LOG.info("Left swarm"); info = dockerClient.infoCmd().exec(); LOG.info("Inspected docker: {}", info.toString()); assertThat(info.getSwarm().getLocalNodeState(), is(LocalNodeState.INACTIVE)); }
Example #2
Source File: DockerTraceabilityReport.java From docker-traceability-plugin with MIT License | 5 votes |
public DockerTraceabilityReport(@Nonnull Event event, @Nonnull Info hostInfo, @CheckForNull InspectContainerResponse container, @CheckForNull String imageId, @CheckForNull String imageName, @CheckForNull InspectImageResponse image, @Nonnull List<String> parents, @CheckForNull String environment) { this.event = event; this.hostInfo = hostInfo; this.container = container; this.imageId = imageId; this.image = image; this.parents = new ArrayList<String>(parents); this.imageName = imageName; this.environment = environment; }
Example #3
Source File: InfoCmdIT.java From docker-java with Apache License 2.0 | 5 votes |
@Test public void infoTest() throws DockerException { DockerClient dockerClient = dockerRule.getClient(); // Make sure that there is at least one container for the assertion // TODO extract this into a shared method if (dockerClient.listContainersCmd().withShowAll(true).exec().size() == 0) { CreateContainerResponse container = dockerClient.createContainerCmd(DEFAULT_IMAGE) .withName("docker-java-itest-info") .withCmd("touch", "/test") .exec(); LOG.info("Created container: {}", container); assertThat(container.getId(), not(isEmptyOrNullString())); dockerClient.startContainerCmd(container.getId()).exec(); } Info dockerInfo = dockerClient.infoCmd().exec(); LOG.info(dockerInfo.toString()); assertThat(dockerInfo.getContainers(), notNullValue()); assertThat(dockerInfo.getContainers(), greaterThan(0)); assertThat(dockerInfo.getImages(), notNullValue()); assertThat(dockerInfo.getImages(), greaterThan(0)); assertThat(dockerInfo.getDebug(), notNullValue()); if (isNotSwarm(dockerClient)) { assertThat(dockerInfo.getNFd(), greaterThan(0)); assertThat(dockerInfo.getNGoroutines(), greaterThan(0)); assertThat(dockerInfo.getNCPU(), greaterThan(0)); } }
Example #4
Source File: DockerClientOperationTest.java From redis-manager with Apache License 2.0 | 4 votes |
@Test public void getDockerInfo() { Info dockerInfo = dockerClientOperation.getDockerInfo(IP); System.err.println(dockerInfo); }
Example #5
Source File: DockerClientFactoryBeanTest.java From Dolphin with Apache License 2.0 | 4 votes |
@Test public void dockerInfo() throws Exception { Info info = dockerClient.infoCmd().exec(); Assert.assertNotNull(info); }
Example #6
Source File: DockerClientJavaApi.java From doclipser with Eclipse Public License 1.0 | 4 votes |
@Override public void infoCommand() { Info info = dockerClient.infoCmd().exec(); System.out.print(info); }
Example #7
Source File: DockerTraceabilityReport.java From docker-traceability-plugin with MIT License | 4 votes |
/** * Stub constructor for deserialization purposes. */ public DockerTraceabilityReport() { event = new Event(); hostInfo = new Info(); parents = new LinkedList<String>(); }
Example #8
Source File: DockerTraceabilityReport.java From docker-traceability-plugin with MIT License | 4 votes |
public @Nonnull Info getHostInfo() { return hostInfo; }
Example #9
Source File: PullImageCmdIT.java From docker-java with Apache License 2.0 | 4 votes |
@Test public void testPullImage() throws Exception { Info info = dockerRule.getClient().infoCmd().exec(); LOG.info("Client info: {}", info.toString()); int imgCount = info.getImages(); LOG.info("imgCount1: {}", imgCount); // This should be an image that is not used by other repositories // already // pulled down, preferably small in size. If tag is not used pull will // download all images in that repository but tmpImgs will only // deleted 'latest' image but not images with other tags String testImage = "hackmann/empty"; LOG.info("Removing image: {}", testImage); try { dockerRule.getClient().removeImageCmd(testImage).withForce(true).exec(); } catch (NotFoundException e) { // just ignore if not exist } info = dockerRule.getClient().infoCmd().exec(); LOG.info("Client info: {}", info.toString()); imgCount = info.getImages(); LOG.info("imgCount2: {}", imgCount); LOG.info("Pulling image: {}", testImage); dockerRule.getClient().pullImageCmd(testImage) .start() .awaitCompletion(30, TimeUnit.SECONDS); info = dockerRule.getClient().infoCmd().exec(); LOG.info("Client info after pull, {}", info.toString()); assertThat(imgCount, lessThanOrEqualTo(info.getImages())); InspectImageResponse inspectImageResponse = dockerRule.getClient().inspectImageCmd(testImage).exec(); LOG.info("Image Inspect: {}", inspectImageResponse.toString()); assertThat(inspectImageResponse, notNullValue()); }
Example #10
Source File: InfoCmdExec.java From docker-java with Apache License 2.0 | 4 votes |
@Override public Info exec(InfoCmd command) { return webResource.path("info").request().get(new TypeReference<Info>() { }); }
Example #11
Source File: DockerConnector.java From cloudml with GNU Lesser General Public License v3.0 | 4 votes |
public Info getInfo(){ Info info = dockerClient.infoCmd().exec(); return info; }