From a1d1e3dfda7a2ade9304c990f73d42aa573ef342 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 24 May 2016 14:19:28 -0600 Subject: [PATCH 1/4] Fixes Issue #584 Adds RootDir property to GraphData. This was seen on a CentOS system without aufs support. --- .../dockerjava/api/command/GraphData.java | 26 ++- .../api/command/InspectImageResponseTest.java | 197 +++++++++--------- 2 files changed, 122 insertions(+), 101 deletions(-) diff --git a/src/main/java/com/github/dockerjava/api/command/GraphData.java b/src/main/java/com/github/dockerjava/api/command/GraphData.java index dc55810ba..a00f44e5d 100644 --- a/src/main/java/com/github/dockerjava/api/command/GraphData.java +++ b/src/main/java/com/github/dockerjava/api/command/GraphData.java @@ -1,17 +1,23 @@ package com.github.dockerjava.api.command; -import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.CheckForNull; + import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; -import javax.annotation.CheckForNull; +import com.fasterxml.jackson.annotation.JsonProperty; /** * part of {@link GraphDriver} + * * @author Kanstantsin Shautsou */ public class GraphData { + + @JsonProperty("RootDir") + private String rootDir; + @JsonProperty("DeviceId") private String deviceId; @@ -21,6 +27,22 @@ public class GraphData { @JsonProperty("DeviceSize") private String deviceSize; + /** + * @see #rootDir + */ + @CheckForNull + public String getRootDir() { + return rootDir; + } + + /** + * @see #deviceId + */ + public GraphData withRootDir(String rootDir) { + this.rootDir = rootDir; + return this; + } + /** * @see #deviceId */ diff --git a/src/test/java/com/github/dockerjava/api/command/InspectImageResponseTest.java b/src/test/java/com/github/dockerjava/api/command/InspectImageResponseTest.java index 410d5b32a..e7cd2aaa8 100644 --- a/src/test/java/com/github/dockerjava/api/command/InspectImageResponseTest.java +++ b/src/test/java/com/github/dockerjava/api/command/InspectImageResponseTest.java @@ -1,13 +1,5 @@ package com.github.dockerjava.api.command; -import com.fasterxml.jackson.databind.JavaType; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.github.dockerjava.api.model.ContainerConfig; -import org.testng.annotations.Test; - -import java.io.IOException; -import java.util.Collections; - import static com.github.dockerjava.core.RemoteApiVersion.VERSION_1_22; import static com.github.dockerjava.test.serdes.JSONSamples.testRoundTrip; import static org.hamcrest.MatcherAssert.assertThat; @@ -21,65 +13,72 @@ import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.nullValue; +import java.io.IOException; +import java.util.Collections; + +import org.testng.annotations.Test; + +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.dockerjava.api.model.ContainerConfig; + /** * @author Kanstantsin Shautsou */ public class InspectImageResponseTest { + @Test public void serder1_22Json() throws IOException { final ObjectMapper mapper = new ObjectMapper(); final JavaType type = mapper.getTypeFactory().constructType(InspectImageResponse.class); - final InspectImageResponse inspectImage = testRoundTrip(VERSION_1_22, - "images/image1/inspect1.json", - type - ); - - final ContainerConfig config = new ContainerConfig() - .withAttachStderr(false) - .withAttachStdin(false) - .withAttachStdout(false) - .withCmd(null) - .withDomainName("") - .withEntrypoint(null) - .withEnv(new String[]{"HOME=/", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}) - .withExposedPorts(null) - .withHostName("aee9ba801acc") - .withImage("511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158") - .withLabels(null) - .withMacAddress(null) - .withNetworkDisabled(null) - .withOnBuild(new String[]{}) - .withStdinOpen(false) - .withPortSpecs(null) - .withStdInOnce(false) - .withTty(false) - .withUser("") - .withVolumes(null) - .withWorkingDir(""); - - final ContainerConfig containerConfig = new ContainerConfig() - .withAttachStderr(false) - .withAttachStdin(false) - .withAttachStdout(false) - .withCmd(new String[]{"/bin/sh", "-c", "#(nop) MAINTAINER hack@worldticket.net"}) - .withDomainName("") - .withEntrypoint(null) - .withEnv(new String[]{"HOME=/", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}) - .withExposedPorts(null) - .withHostName("aee9ba801acc") - .withImage("511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158") - .withLabels(null) - .withMacAddress(null) - .withNetworkDisabled(null) - .withOnBuild(new String[]{}) - .withStdinOpen(false) - .withPortSpecs(null) - .withStdInOnce(false) - .withTty(false) - .withUser("") - .withVolumes(null) - .withWorkingDir(""); + final InspectImageResponse inspectImage = testRoundTrip(VERSION_1_22, "images/image1/inspect1.json", type); + + final ContainerConfig config = new ContainerConfig().withAttachStderr(false) + .withAttachStdin(false) + .withAttachStdout(false) + .withCmd(null) + .withDomainName("") + .withEntrypoint(null) + .withEnv(new String[] { "HOME=/", + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" }) + .withExposedPorts(null) + .withHostName("aee9ba801acc") + .withImage("511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158") + .withLabels(null) + .withMacAddress(null) + .withNetworkDisabled(null) + .withOnBuild(new String[] {}) + .withStdinOpen(false) + .withPortSpecs(null) + .withStdInOnce(false) + .withTty(false) + .withUser("") + .withVolumes(null) + .withWorkingDir(""); + + final ContainerConfig containerConfig = new ContainerConfig().withAttachStderr(false) + .withAttachStdin(false) + .withAttachStdout(false) + .withCmd(new String[] { "/bin/sh", "-c", "#(nop) MAINTAINER hack@worldticket.net" }) + .withDomainName("") + .withEntrypoint(null) + .withEnv(new String[] { "HOME=/", + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" }) + .withExposedPorts(null) + .withHostName("aee9ba801acc") + .withImage("511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158") + .withLabels(null) + .withMacAddress(null) + .withNetworkDisabled(null) + .withOnBuild(new String[] {}) + .withStdinOpen(false) + .withPortSpecs(null) + .withStdInOnce(false) + .withTty(false) + .withUser("") + .withVolumes(null) + .withWorkingDir(""); assertThat(inspectImage, notNullValue()); assertThat(inspectImage.getArch(), is("amd64")); @@ -113,52 +112,41 @@ public void serder1_22Json() throws IOException { assertThat(inspectImage.getVirtualSize(), is(0L)); - final InspectImageResponse inspectImageResponse = new InspectImageResponse().withArch("amd64") - .withAuthor("hack@worldticket.net") - .withComment("") - .withConfig(config) - .withContainer("aee9ba801acca0e648ffd91df204ba82ae85d97608a4864a019e2004d7e1b133") - .withContainerConfig(containerConfig) - .withCreated("2014-04-29T19:59:10.84997669Z") - .withDockerVersion("0.8.1") - .withId("sha256:ee45fe0d1fcdf1a0f9c2d1e36c6f4b3202bbb2032f14d7c9312b27bfcf6aee24") - .withOs("linux") - .withParent("") - .withSize(0L) - .withRepoTags(Collections.singletonList("hackmann/empty:latest")) - .withRepoDigests(Collections.emptyList()) - .withVirtualSize(0L) - .withGraphDriver(aufsGraphDriver); + .withAuthor("hack@worldticket.net") + .withComment("") + .withConfig(config) + .withContainer("aee9ba801acca0e648ffd91df204ba82ae85d97608a4864a019e2004d7e1b133") + .withContainerConfig(containerConfig) + .withCreated("2014-04-29T19:59:10.84997669Z") + .withDockerVersion("0.8.1") + .withId("sha256:ee45fe0d1fcdf1a0f9c2d1e36c6f4b3202bbb2032f14d7c9312b27bfcf6aee24") + .withOs("linux") + .withParent("") + .withSize(0L) + .withRepoTags(Collections.singletonList("hackmann/empty:latest")) + .withRepoDigests(Collections. emptyList()) + .withVirtualSize(0L) + .withGraphDriver(aufsGraphDriver); assertThat(inspectImage, equalTo(inspectImageResponse)); } - @Test public void serder1_22_doc() throws IOException { final ObjectMapper mapper = new ObjectMapper(); final JavaType type = mapper.getTypeFactory().constructType(InspectImageResponse.class); - final InspectImageResponse inspectImage = testRoundTrip(VERSION_1_22, - "images/docImage/doc.json", - type - ); + final InspectImageResponse inspectImage = testRoundTrip(VERSION_1_22, "images/docImage/doc.json", type); assertThat(inspectImage, notNullValue()); assertThat(inspectImage.getRepoDigests(), hasSize(1)); assertThat(inspectImage.getRepoDigests(), - contains("localhost:5000/test/busybox/example@" + - "sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf") - ); + contains("localhost:5000/test/busybox/example@" + "sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf")); assertThat(inspectImage.getRepoTags(), hasSize(3)); - assertThat(inspectImage.getRepoTags(), containsInAnyOrder( - "example:1.0", - "example:latest", - "example:stable" - )); + assertThat(inspectImage.getRepoTags(), containsInAnyOrder("example:1.0", "example:latest", "example:stable")); } @Test @@ -166,15 +154,11 @@ public void serder1_22_inspect_doc() throws IOException { final ObjectMapper mapper = new ObjectMapper(); final JavaType type = mapper.getTypeFactory().constructType(InspectImageResponse.class); - final InspectImageResponse inspectImage = testRoundTrip(VERSION_1_22, - "images/docImage/inspect_doc.json", - type - ); + final InspectImageResponse inspectImage = testRoundTrip(VERSION_1_22, "images/docImage/inspect_doc.json", type); - GraphData newGraphData = new GraphData() - .withDeviceId("5") - .withDeviceName("docker-253:1-2763198-d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47") - .withDeviceSize("171798691840"); + GraphData newGraphData = new GraphData().withDeviceId("5") + .withDeviceName("docker-253:1-2763198-d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47") + .withDeviceSize("171798691840"); assertThat(inspectImage, notNullValue()); GraphDriver graphDriver = inspectImage.getGraphDriver(); @@ -184,9 +168,24 @@ public void serder1_22_inspect_doc() throws IOException { assertThat(data, is(newGraphData)); assertThat(data.getDeviceId(), is("5")); - assertThat(data.getDeviceName(), - is("docker-253:1-2763198-d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47")); - assertThat(data.getDeviceSize(), - is("171798691840")); + assertThat(data.getDeviceName(), is("docker-253:1-2763198-d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47")); + assertThat(data.getDeviceSize(), is("171798691840")); + } + + @Test + private void testOverlayNetworkRootDir() throws IOException { + final ObjectMapper mapper = new ObjectMapper(); + final JavaType type = mapper.getTypeFactory().constructType(InspectImageResponse.class); + + final InspectImageResponse inspectImage = testRoundTrip(VERSION_1_22, "images/overlay/inspectOverlay.json", type); + + final GraphData overlayGraphData = new GraphData().withRootDir("/var/lib/docker/overlay/7e8d362d6b78d47eafe4863fd129cbcada35dbd419d7188cc1dbf1233d505576/root"); + final GraphDriver overlayGraphDriver = new GraphDriver().withName("overlay").withData(overlayGraphData); + final GraphDriver graphDriver = inspectImage.getGraphDriver(); + assertThat(graphDriver, notNullValue()); + assertThat(graphDriver, equalTo(overlayGraphDriver)); + assertThat(graphDriver.getName(), is("overlay")); + assertThat(graphDriver.getData(), equalTo(overlayGraphData)); + } } \ No newline at end of file From 3f71f1f165d652ceb044151c9abea2b1707d56c9 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 24 May 2016 14:19:28 -0600 Subject: [PATCH 2/4] Fixes Issue #584 Adds RootDir property to GraphData. This was seen on a CentOS system without aufs support. --- .../api/command/InspectImageResponseTest.java | 128 +++++++++--------- .../1.22/images/overlay/inspectOverlay.json | 93 +++++++++++++ 2 files changed, 157 insertions(+), 64 deletions(-) create mode 100644 src/test/resources/samples/1.22/images/overlay/inspectOverlay.json diff --git a/src/test/java/com/github/dockerjava/api/command/InspectImageResponseTest.java b/src/test/java/com/github/dockerjava/api/command/InspectImageResponseTest.java index e7cd2aaa8..5bce25a48 100644 --- a/src/test/java/com/github/dockerjava/api/command/InspectImageResponseTest.java +++ b/src/test/java/com/github/dockerjava/api/command/InspectImageResponseTest.java @@ -34,51 +34,49 @@ public void serder1_22Json() throws IOException { final InspectImageResponse inspectImage = testRoundTrip(VERSION_1_22, "images/image1/inspect1.json", type); - final ContainerConfig config = new ContainerConfig().withAttachStderr(false) - .withAttachStdin(false) - .withAttachStdout(false) - .withCmd(null) - .withDomainName("") - .withEntrypoint(null) - .withEnv(new String[] { "HOME=/", - "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" }) - .withExposedPorts(null) - .withHostName("aee9ba801acc") - .withImage("511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158") - .withLabels(null) - .withMacAddress(null) - .withNetworkDisabled(null) - .withOnBuild(new String[] {}) - .withStdinOpen(false) - .withPortSpecs(null) - .withStdInOnce(false) - .withTty(false) - .withUser("") - .withVolumes(null) - .withWorkingDir(""); + final ContainerConfig config = new ContainerConfig().withAttachStdout(false) + .withCmd(null) + .withDomainName("") + .withEntrypoint(null) + .withEnv(new String[] {"HOME=/", + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}) + .withExposedPorts(null) + .withHostName("aee9ba801acc") + .withImage("511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158") + .withLabels(null) + .withMacAddress(null) + .withNetworkDisabled(null) + .withOnBuild(new String[] {}) + .withStdinOpen(false) + .withPortSpecs(null) + .withStdInOnce(false) + .withTty(false) + .withUser("") + .withVolumes(null) + .withWorkingDir(""); final ContainerConfig containerConfig = new ContainerConfig().withAttachStderr(false) - .withAttachStdin(false) - .withAttachStdout(false) - .withCmd(new String[] { "/bin/sh", "-c", "#(nop) MAINTAINER hack@worldticket.net" }) - .withDomainName("") - .withEntrypoint(null) - .withEnv(new String[] { "HOME=/", - "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" }) - .withExposedPorts(null) - .withHostName("aee9ba801acc") - .withImage("511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158") - .withLabels(null) - .withMacAddress(null) - .withNetworkDisabled(null) - .withOnBuild(new String[] {}) - .withStdinOpen(false) - .withPortSpecs(null) - .withStdInOnce(false) - .withTty(false) - .withUser("") - .withVolumes(null) - .withWorkingDir(""); + .withAttachStdin(false) + .withAttachStdout(false) + .withCmd(new String[] {"/bin/sh", "-c", "#(nop) MAINTAINER hack@worldticket.net"}) + .withDomainName("") + .withEntrypoint(null) + .withEnv(new String[] {"HOME=/", + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}) + .withExposedPorts(null) + .withHostName("aee9ba801acc") + .withImage("511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158") + .withLabels(null) + .withMacAddress(null) + .withNetworkDisabled(null) + .withOnBuild(new String[] {}) + .withStdinOpen(false) + .withPortSpecs(null) + .withStdInOnce(false) + .withTty(false) + .withUser("") + .withVolumes(null) + .withWorkingDir(""); assertThat(inspectImage, notNullValue()); assertThat(inspectImage.getArch(), is("amd64")); @@ -113,21 +111,21 @@ public void serder1_22Json() throws IOException { assertThat(inspectImage.getVirtualSize(), is(0L)); final InspectImageResponse inspectImageResponse = new InspectImageResponse().withArch("amd64") - .withAuthor("hack@worldticket.net") - .withComment("") - .withConfig(config) - .withContainer("aee9ba801acca0e648ffd91df204ba82ae85d97608a4864a019e2004d7e1b133") - .withContainerConfig(containerConfig) - .withCreated("2014-04-29T19:59:10.84997669Z") - .withDockerVersion("0.8.1") - .withId("sha256:ee45fe0d1fcdf1a0f9c2d1e36c6f4b3202bbb2032f14d7c9312b27bfcf6aee24") - .withOs("linux") - .withParent("") - .withSize(0L) - .withRepoTags(Collections.singletonList("hackmann/empty:latest")) - .withRepoDigests(Collections. emptyList()) - .withVirtualSize(0L) - .withGraphDriver(aufsGraphDriver); + .withAuthor("hack@worldticket.net") + .withComment("") + .withConfig(config) + .withContainer("aee9ba801acca0e648ffd91df204ba82ae85d97608a4864a019e2004d7e1b133") + .withContainerConfig(containerConfig) + .withCreated("2014-04-29T19:59:10.84997669Z") + .withDockerVersion("0.8.1") + .withId("sha256:ee45fe0d1fcdf1a0f9c2d1e36c6f4b3202bbb2032f14d7c9312b27bfcf6aee24") + .withOs("linux") + .withParent("") + .withSize(0L) + .withRepoTags(Collections.singletonList("hackmann/empty:latest")) + .withRepoDigests(Collections. emptyList()) + .withVirtualSize(0L) + .withGraphDriver(aufsGraphDriver); assertThat(inspectImage, equalTo(inspectImageResponse)); } @@ -143,7 +141,9 @@ public void serder1_22_doc() throws IOException { assertThat(inspectImage.getRepoDigests(), hasSize(1)); assertThat(inspectImage.getRepoDigests(), - contains("localhost:5000/test/busybox/example@" + "sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf")); + + contains("localhost:5000/test/busybox/example@" + + "sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf")); assertThat(inspectImage.getRepoTags(), hasSize(3)); assertThat(inspectImage.getRepoTags(), containsInAnyOrder("example:1.0", "example:latest", "example:stable")); @@ -157,9 +157,8 @@ public void serder1_22_inspect_doc() throws IOException { final InspectImageResponse inspectImage = testRoundTrip(VERSION_1_22, "images/docImage/inspect_doc.json", type); GraphData newGraphData = new GraphData().withDeviceId("5") - .withDeviceName("docker-253:1-2763198-d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47") - .withDeviceSize("171798691840"); - + .withDeviceName("docker-253:1-2763198-d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47") + .withDeviceSize("171798691840"); assertThat(inspectImage, notNullValue()); GraphDriver graphDriver = inspectImage.getGraphDriver(); assertThat(graphDriver, notNullValue()); @@ -179,7 +178,8 @@ private void testOverlayNetworkRootDir() throws IOException { final InspectImageResponse inspectImage = testRoundTrip(VERSION_1_22, "images/overlay/inspectOverlay.json", type); - final GraphData overlayGraphData = new GraphData().withRootDir("/var/lib/docker/overlay/7e8d362d6b78d47eafe4863fd129cbcada35dbd419d7188cc1dbf1233d505576/root"); + final GraphData overlayGraphData = new GraphData() + .withRootDir("/var/lib/docker/overlay/7e8d362d6b78d47eafe4863fd129cbcada35dbd419d7188cc1dbf1233d505576/root"); final GraphDriver overlayGraphDriver = new GraphDriver().withName("overlay").withData(overlayGraphData); final GraphDriver graphDriver = inspectImage.getGraphDriver(); assertThat(graphDriver, notNullValue()); @@ -188,4 +188,4 @@ private void testOverlayNetworkRootDir() throws IOException { assertThat(graphDriver.getData(), equalTo(overlayGraphData)); } -} \ No newline at end of file +} diff --git a/src/test/resources/samples/1.22/images/overlay/inspectOverlay.json b/src/test/resources/samples/1.22/images/overlay/inspectOverlay.json new file mode 100644 index 000000000..7e3fe0bea --- /dev/null +++ b/src/test/resources/samples/1.22/images/overlay/inspectOverlay.json @@ -0,0 +1,93 @@ +{ + "Id": "sha256:0ac989a7cba2ce7f5fbe5d520b338e780055ec251371ee35f7462ae9944696c5", + "RepoTags": [ + "test-image:latest" + ], + "RepoDigests": [], + "Parent": "", + "Comment": "", + "Created": "2016-05-24T19:25:01.31608131Z", + "Container": "221f000eccdec85b74cd4f4f37c7c0392d0f620bee45e9618cac3e57409a6d2c", + "ContainerConfig": { + "Hostname": "6ea525e7ec5c", + "Domainname": "", + "User": "", + "AttachStdin": false, + "AttachStdout": false, + "AttachStderr": false, + "Tty": false, + "OpenStdin": false, + "StdinOnce": false, + "Env": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + ], + "Cmd": [ + "/bin/sh", + "-c", + "#(nop) ENTRYPOINT [\"bin/run.sh\"]" + ], + "Image": "sha256:f8321fac5b5484874c1c5c02719905ec815c8ad20c2bc66222cfde19cd0491b7", + "Volumes": { + "/var/lib/docker": {} + }, + "WorkingDir": "/opt", + "Entrypoint": [ + "bin/run.sh" + ], + "OnBuild": [], + "Labels": {} + }, + "DockerVersion": "1.11.1", + "Author": "", + "Config": { + "Hostname": "6ea525e7ec5c", + "Domainname": "", + "User": "", + "AttachStdin": false, + "AttachStdout": false, + "AttachStderr": false, + "Tty": false, + "OpenStdin": false, + "StdinOnce": false, + "Env": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + ], + "Cmd": null, + "Image": "sha256:f8321fac5b5484874c1c5c02719905ec815c8ad20c2bc66222cfde19cd0491b7", + "Volumes": { + "/var/lib/docker": {} + }, + "WorkingDir": "/opt", + "Entrypoint": [ + "bin/run.sh" + ], + "OnBuild": [], + "Labels": {} + }, + "Architecture": "amd64", + "Os": "linux", + "Size": 345943268, + "VirtualSize": 345943268, + "GraphDriver": { + "Name": "overlay", + "Data": { + "RootDir": "/var/lib/docker/overlay/7e8d362d6b78d47eafe4863fd129cbcada35dbd419d7188cc1dbf1233d505576/root" + } + }, + "RootFS": { + "Type": "layers", + "Layers": [ + "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef", + "sha256:bd8153423e4131205018c431283e0a08298b291838db9bc6c19620523f5a818c", + "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef", + "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef", + "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef", + "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef", + "sha256:bb0716c3f5f5be1e5ee6912f7e9f44193898e0b3ed9031a0416f8ca262e89975", + "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef", + "sha256:58845ae9bfa7659900a9b30abb2c96330eff09bfbc6521ea77937ba60f8cc131", + "sha256:8c22161a61c24eb6f7aa130d45189354fd8dbe9467e5b2debf828908113eacb0", + "sha256:0c0c9045d2542e7845a2bdd8ead0e0fb2722be2c07c5553838dd61ffe051d672" + ] + } +} \ No newline at end of file From 9b8ca72947b771c6fbeda00d17b9382fed2c09a6 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 24 May 2016 14:19:28 -0600 Subject: [PATCH 3/4] Fixes Issue #584 Adds RootDir property to GraphData. This was seen on a CentOS system without aufs support. --- .../dockerjava/api/command/GraphData.java | 6 +- .../api/command/InspectImageResponseTest.java | 80 ++++++++++++------- 2 files changed, 51 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/github/dockerjava/api/command/GraphData.java b/src/main/java/com/github/dockerjava/api/command/GraphData.java index a00f44e5d..1aac8db84 100644 --- a/src/main/java/com/github/dockerjava/api/command/GraphData.java +++ b/src/main/java/com/github/dockerjava/api/command/GraphData.java @@ -1,16 +1,14 @@ package com.github.dockerjava.api.command; -import javax.annotation.CheckForNull; - +import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; -import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.CheckForNull; /** * part of {@link GraphDriver} - * * @author Kanstantsin Shautsou */ public class GraphData { diff --git a/src/test/java/com/github/dockerjava/api/command/InspectImageResponseTest.java b/src/test/java/com/github/dockerjava/api/command/InspectImageResponseTest.java index 5bce25a48..4c604e6a0 100644 --- a/src/test/java/com/github/dockerjava/api/command/InspectImageResponseTest.java +++ b/src/test/java/com/github/dockerjava/api/command/InspectImageResponseTest.java @@ -1,5 +1,13 @@ package com.github.dockerjava.api.command; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.dockerjava.api.model.ContainerConfig; +import org.testng.annotations.Test; + +import java.io.IOException; +import java.util.Collections; + import static com.github.dockerjava.core.RemoteApiVersion.VERSION_1_22; import static com.github.dockerjava.test.serdes.JSONSamples.testRoundTrip; import static org.hamcrest.MatcherAssert.assertThat; @@ -13,40 +21,35 @@ import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.nullValue; -import java.io.IOException; -import java.util.Collections; - -import org.testng.annotations.Test; - -import com.fasterxml.jackson.databind.JavaType; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.github.dockerjava.api.model.ContainerConfig; - /** * @author Kanstantsin Shautsou */ public class InspectImageResponseTest { - @Test public void serder1_22Json() throws IOException { final ObjectMapper mapper = new ObjectMapper(); final JavaType type = mapper.getTypeFactory().constructType(InspectImageResponse.class); - final InspectImageResponse inspectImage = testRoundTrip(VERSION_1_22, "images/image1/inspect1.json", type); + final InspectImageResponse inspectImage = testRoundTrip(VERSION_1_22, + "images/image1/inspect1.json", + type + ); - final ContainerConfig config = new ContainerConfig().withAttachStdout(false) + final ContainerConfig config = new ContainerConfig() + .withAttachStderr(false) + .withAttachStdin(false) + .withAttachStdout(false) .withCmd(null) .withDomainName("") .withEntrypoint(null) - .withEnv(new String[] {"HOME=/", - "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}) + .withEnv(new String[]{"HOME=/", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}) .withExposedPorts(null) .withHostName("aee9ba801acc") .withImage("511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158") .withLabels(null) .withMacAddress(null) .withNetworkDisabled(null) - .withOnBuild(new String[] {}) + .withOnBuild(new String[]{}) .withStdinOpen(false) .withPortSpecs(null) .withStdInOnce(false) @@ -55,21 +58,21 @@ public void serder1_22Json() throws IOException { .withVolumes(null) .withWorkingDir(""); - final ContainerConfig containerConfig = new ContainerConfig().withAttachStderr(false) + final ContainerConfig containerConfig = new ContainerConfig() + .withAttachStderr(false) .withAttachStdin(false) .withAttachStdout(false) - .withCmd(new String[] {"/bin/sh", "-c", "#(nop) MAINTAINER hack@worldticket.net"}) + .withCmd(new String[]{"/bin/sh", "-c", "#(nop) MAINTAINER hack@worldticket.net"}) .withDomainName("") .withEntrypoint(null) - .withEnv(new String[] {"HOME=/", - "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}) + .withEnv(new String[]{"HOME=/", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}) .withExposedPorts(null) .withHostName("aee9ba801acc") .withImage("511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158") .withLabels(null) .withMacAddress(null) .withNetworkDisabled(null) - .withOnBuild(new String[] {}) + .withOnBuild(new String[]{}) .withStdinOpen(false) .withPortSpecs(null) .withStdInOnce(false) @@ -110,6 +113,7 @@ public void serder1_22Json() throws IOException { assertThat(inspectImage.getVirtualSize(), is(0L)); + final InspectImageResponse inspectImageResponse = new InspectImageResponse().withArch("amd64") .withAuthor("hack@worldticket.net") .withComment("") @@ -123,30 +127,38 @@ public void serder1_22Json() throws IOException { .withParent("") .withSize(0L) .withRepoTags(Collections.singletonList("hackmann/empty:latest")) - .withRepoDigests(Collections. emptyList()) + .withRepoDigests(Collections.emptyList()) .withVirtualSize(0L) .withGraphDriver(aufsGraphDriver); assertThat(inspectImage, equalTo(inspectImageResponse)); } + @Test public void serder1_22_doc() throws IOException { final ObjectMapper mapper = new ObjectMapper(); final JavaType type = mapper.getTypeFactory().constructType(InspectImageResponse.class); - final InspectImageResponse inspectImage = testRoundTrip(VERSION_1_22, "images/docImage/doc.json", type); + final InspectImageResponse inspectImage = testRoundTrip(VERSION_1_22, + "images/docImage/doc.json", + type + ); assertThat(inspectImage, notNullValue()); assertThat(inspectImage.getRepoDigests(), hasSize(1)); assertThat(inspectImage.getRepoDigests(), - - contains("localhost:5000/test/busybox/example@" - + "sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf")); + contains("localhost:5000/test/busybox/example@" + + "sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf") + ); assertThat(inspectImage.getRepoTags(), hasSize(3)); - assertThat(inspectImage.getRepoTags(), containsInAnyOrder("example:1.0", "example:latest", "example:stable")); + assertThat(inspectImage.getRepoTags(), containsInAnyOrder( + "example:1.0", + "example:latest", + "example:stable" + )); } @Test @@ -154,11 +166,16 @@ public void serder1_22_inspect_doc() throws IOException { final ObjectMapper mapper = new ObjectMapper(); final JavaType type = mapper.getTypeFactory().constructType(InspectImageResponse.class); - final InspectImageResponse inspectImage = testRoundTrip(VERSION_1_22, "images/docImage/inspect_doc.json", type); + final InspectImageResponse inspectImage = testRoundTrip(VERSION_1_22, + "images/docImage/inspect_doc.json", + type + ); - GraphData newGraphData = new GraphData().withDeviceId("5") + GraphData newGraphData = new GraphData() + .withDeviceId("5") .withDeviceName("docker-253:1-2763198-d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47") .withDeviceSize("171798691840"); + assertThat(inspectImage, notNullValue()); GraphDriver graphDriver = inspectImage.getGraphDriver(); assertThat(graphDriver, notNullValue()); @@ -167,8 +184,10 @@ public void serder1_22_inspect_doc() throws IOException { assertThat(data, is(newGraphData)); assertThat(data.getDeviceId(), is("5")); - assertThat(data.getDeviceName(), is("docker-253:1-2763198-d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47")); - assertThat(data.getDeviceSize(), is("171798691840")); + assertThat(data.getDeviceName(), + is("docker-253:1-2763198-d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47")); + assertThat(data.getDeviceSize(), + is("171798691840")); } @Test @@ -186,6 +205,5 @@ private void testOverlayNetworkRootDir() throws IOException { assertThat(graphDriver, equalTo(overlayGraphDriver)); assertThat(graphDriver.getName(), is("overlay")); assertThat(graphDriver.getData(), equalTo(overlayGraphData)); - } } From d05e38078117c8e1f20ab4ecc20575b64cb801bc Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 24 May 2016 14:19:28 -0600 Subject: [PATCH 4/4] Fixes Issue #584 Adds RootDir property to GraphData. This was seen on a CentOS system without aufs support. --- src/main/java/com/github/dockerjava/api/command/GraphData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/dockerjava/api/command/GraphData.java b/src/main/java/com/github/dockerjava/api/command/GraphData.java index 1aac8db84..5130fafc7 100644 --- a/src/main/java/com/github/dockerjava/api/command/GraphData.java +++ b/src/main/java/com/github/dockerjava/api/command/GraphData.java @@ -34,7 +34,7 @@ public String getRootDir() { } /** - * @see #deviceId + * @see #rootDir */ public GraphData withRootDir(String rootDir) { this.rootDir = rootDir;