FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

docker info fails via the java client if the daemon is started with the --insecure-registry option · Issue #507 · docker-java/docker-java · GitHub

Repository navigation

docker info fails via the java client if the daemon is started with the --insecure-registry option #507

Closed

Description

I'm using com.github.docker-java:docker-java:3.0.0-RC3 against a docker 1.10.3 host. When I docker.infoCmd().exec() I get the following exception.

javax.ws.rs.ProcessingException: Error reading entity from input stream.
    at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:866)
    at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:783)
    at org.glassfish.jersey.client.ClientResponse.readEntity(ClientResponse.java:326)
    at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:786)
    at org.glassfish.jersey.client.JerseyInvocation.access$500(JerseyInvocation.java:91)
    at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:683)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:424)
    at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:679)
    at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:408)
    at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:308)
    at com.github.dockerjava.jaxrs.InfoCmdExec.execute(InfoCmdExec.java:26)
        ......
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_ARRAY token
 at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@c679b02e; line: 1, column: 1857] (through reference chain: com.github.dockerjava.api.model.Info["RegistryConfig"]->com.github.dockerjava.api.model.InfoRegistryConfig["IndexConfigs"]->java.util.LinkedHashMap["some-host-name:80"]->com.github.dockerjava.api.model.IndexConfig["Mirrors"])
    at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148)
    at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:857)
    at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:62)
    at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:11)
    at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:520)
    at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:101)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:258)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:125)
    at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringMap(MapDeserializer.java:495)
    at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:341)
    at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:26)
    at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:520)
    at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:101)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:258)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:125)
    at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:520)
    at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:101)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:258)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:125)
    at com.fasterxml.jackson.databind.ObjectReader._bind(ObjectReader.java:1470)
    at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:912)
    at com.fasterxml.jackson.jaxrs.base.ProviderBase.readFrom(ProviderBase.java:811)
    at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.invokeReadFrom(ReaderInterceptorExecutor.java:264)
    at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:234)
    at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:154)
    at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:1124)
    at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:851)
    ... 106 more

The part of the JSON that the daemon returns, which seems to cause the problem looks like this:

"IndexConfigs":{
 "docker.io":{
    "Name":"docker.io",
    "Mirrors":null,
    "Secure":true,
    "Official":true
 },
 "some-host-name:80":{
    "Name":"some-host-name:80",
    "Mirrors":[

    ],
    "Secure":false,
    "Official":false
 }
}

The docker CLI has no problem with that reply.

Activity

  1. KostyaSha commented on Mar 18, 2016

    Member

    Could you propose fix or test case?

  2. Hendrik-H commented on Mar 18, 2016

    ContributorAuthor

    I don't quite understand the parsing code and it seems to fail not even in the docker code. So I guess the first question would be if the reply from the daemon is ok or not and why the parser does not like that. In a JSON validator I did not get an error.
    I assume one should be able to reproduce this by changing https://github.com/docker-java/docker-java/blob/master/src/test/resources/samples/1.22/info/1.json. Looks like one might be able to just add the "some.host-name" part from above.

  3. Hendrik-H commented on Mar 20, 2016

    ContributorAuthor

    The problem can be reproduced with this change in the test:

    diff --git a/src/test/resources/samples/1.22/info/1.json b/src/test/resources/samples/1.22/info/1.json
    index 42ceb1b..400146d 100644
    --- a/src/test/resources/samples/1.22/info/1.json
    +++ b/src/test/resources/samples/1.22/info/1.json
    @@ -68,6 +68,14 @@
             "Mirrors": null,
             "Secure": true,
             "Official": true
    +      },
    +      "somehost:80":{
    +        "Name":"dx-proto-docker-registry.rtp.raleigh.ibm.com:80",
    +        "Mirrors":[
    +
    +        ],
    +        "Secure":false,
    +        "Official":false
           }
         },
         "Mirrors": null
    

    With the following change the test seems to pass and I'm also able to perform the info command that failed earlier:

    diff --git a/src/main/java/com/github/dockerjava/api/model/InfoRegistryConfig.java b/src/main/java/com/github/dockerjava/api/model/InfoRegistryConfig.java
    index cc67994..cd9faec 100644
    --- a/src/main/java/com/github/dockerjava/api/model/InfoRegistryConfig.java
    +++ b/src/main/java/com/github/dockerjava/api/model/InfoRegistryConfig.java
    @@ -96,7 +96,7 @@ public final class InfoRegistryConfig {
         @JsonIgnoreProperties(ignoreUnknown = true)
         public static final class IndexConfig {
             @JsonProperty("Mirrors")
    -        private String mirrors;
    +        private String[] mirrors;
    
             @JsonProperty("Name")
             private String name;
    @@ -111,14 +111,14 @@ public final class InfoRegistryConfig {
              * @see #mirrors
              */
             @CheckForNull
    -        public String getMirrors() {
    +        public String[] getMirrors() {
                 return mirrors;
             }
    
             /**
              * @see #mirrors
              */
    -        public IndexConfig withMirrors(String mirrors) {
    +        public IndexConfig withMirrors(String[] mirrors) {
                 this.mirrors = mirrors;
                 return this;
             }
    
  4. KostyaSha commented on Mar 20, 2016

    Member

    Please don't modify already existed dumps, they made either from real responses either from existed documentation. Please add new dump and test part that you really need. Also please use List instead array.

  5. KostyaSha commented on Mar 27, 2016

    Member

    resolved via #527

  6. added this to the 3.0.0-RC4 milestone on Mar 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL