{"action":"created","issue":{"url":"https://api.github.com/repos/docker-java/docker-java/issues/429","labels_url":"https://api.github.com/repos/docker-java/docker-java/issues/429/labels{/name}","comments_url":"https://api.github.com/repos/docker-java/docker-java/issues/429/comments","events_url":"https://api.github.com/repos/docker-java/docker-java/issues/429/events","html_url":"https://github.com/docker-java/docker-java/issues/429","id":127662803,"number":429,"title":"unable to search image from private repository","user":{"login":"pendyala","id":432162,"avatar_url":"https://avatars.githubusercontent.com/u/432162?v=3","gravatar_id":"","url":"https://api.github.com/users/pendyala","html_url":"https://github.com/pendyala","followers_url":"https://api.github.com/users/pendyala/followers","following_url":"https://api.github.com/users/pendyala/following{/other_user}","gists_url":"https://api.github.com/users/pendyala/gists{/gist_id}","starred_url":"https://api.github.com/users/pendyala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pendyala/subscriptions","organizations_url":"https://api.github.com/users/pendyala/orgs","repos_url":"https://api.github.com/users/pendyala/repos","events_url":"https://api.github.com/users/pendyala/events{/privacy}","received_events_url":"https://api.github.com/users/pendyala/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/docker-java/docker-java/labels/invalid","name":"invalid","color":"e6e6e6"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-20T11:29:32Z","updated_at":"2016-01-20T11:39:06Z","closed_at":"2016-01-20T11:30:13Z","body":"Unable to search image from private repository. "},"comment":{"url":"https://api.github.com/repos/docker-java/docker-java/issues/comments/173179332","html_url":"https://github.com/docker-java/docker-java/issues/429#issuecomment-173179332","issue_url":"https://api.github.com/repos/docker-java/docker-java/issues/429","id":173179332,"user":{"login":"pendyala","id":432162,"avatar_url":"https://avatars.githubusercontent.com/u/432162?v=3","gravatar_id":"","url":"https://api.github.com/users/pendyala","html_url":"https://github.com/pendyala","followers_url":"https://api.github.com/users/pendyala/followers","following_url":"https://api.github.com/users/pendyala/following{/other_user}","gists_url":"https://api.github.com/users/pendyala/gists{/gist_id}","starred_url":"https://api.github.com/users/pendyala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pendyala/subscriptions","organizations_url":"https://api.github.com/users/pendyala/orgs","repos_url":"https://api.github.com/users/pendyala/repos","events_url":"https://api.github.com/users/pendyala/events{/privacy}","received_events_url":"https://api.github.com/users/pendyala/received_events","type":"User","site_admin":false},"created_at":"2016-01-20T11:39:06Z","updated_at":"2016-01-20T11:39:06Z","body":"I followed the code snippets provided on the README of the project. I am able to search images from the docker hub public repo, but when I try to the same with our private repository I am not getting any positive response. I am not seeing any error, but an empty list. Below is the source code. \r\n\r\nimport com.github.dockerjava.api.DockerClient;\r\nimport com.github.dockerjava.api.exception.DockerException;\r\nimport com.github.dockerjava.api.model.*;\r\nimport com.github.dockerjava.core.DockerClientBuilder;\r\nimport com.github.dockerjava.core.DockerClientConfig;\r\nimport com.github.dockerjava.jaxrs.DockerCmdExecFactoryImpl;\r\n\r\nimport java.util.List;\r\nimport java.util.Properties;\r\n\r\npublic class App {\r\n\r\n  //public static final Logger LOG = LoggerFactory.getLogger( App.class );\r\n\r\n  private DockerClient dockerClient;\r\n\r\n  public App( ) {\r\n    init( );\r\n  }\r\n\r\n  public static void main( String[] args ) {\r\n    App app = new App( );\r\n\r\n    try {\r\n      app.getDockerInfo( );\r\n      app.getDockerVersion( );\r\n      app.searchDockerRepository( );\r\n      //app.createContainer( );\r\n      //app.listImage( );\r\n      //app.listContainers( );\r\n    } catch ( DockerException de ) {\r\n      System.out.println( \"Error DockerException !!! \" + de );\r\n    } catch ( Exception e ) {\r\n      System.out.println( \"Error Exception !!! \" + e );\r\n    }\r\n\r\n  }\r\n\r\n  private void init( ) {\r\n\r\n    Properties dockerConfigurationProperties = new Properties( );\r\n    dockerConfigurationProperties.put( \"docker.io.url\", \"http://192.168.0.107:4243\" );\r\n    dockerConfigurationProperties.put( \"docker.io.serverAddress\", \"https://xxxx.xxxx.xxxx.xxxx/v1/\" );\r\n    dockerConfigurationProperties.put( \"docker.io.username\", \"xxxxxx\" );\r\n    dockerConfigurationProperties.put( \"docker.io.password\", \"xxxxxxx\" );\r\n    dockerConfigurationProperties.put( \"docker.io.email\", \"xxxxx@xxxxx.com\" );\r\n\r\n    try {\r\n      DockerClientConfig config = DockerClientConfig.createDefaultConfigBuilder( )\r\n        //.withUri( \"http://192.168.0.107:4243\" )\r\n        //.withServerAddress( \"https://xxxxx.xxxx.xxxx.xxxx/v1/\" )\r\n        //.withUsername( \"xxxxx\" )\r\n        // .withPassword( \"xxxxxx\" )\r\n        // .withEmail( \"xxxx@xxxx.com\" )\r\n        .withProperties( dockerConfigurationProperties )\r\n        .build( );\r\n\r\n      DockerCmdExecFactoryImpl dockerCmdExecFactory = new DockerCmdExecFactoryImpl( )\r\n        .withReadTimeout( 100000 )\r\n        .withConnectTimeout( 100000 )\r\n        .withMaxTotalConnections( 100 )\r\n        .withMaxPerRouteConnections( 10 );\r\n\r\n      dockerClient = DockerClientBuilder.getInstance( config )\r\n        .withDockerCmdExecFactory( dockerCmdExecFactory )\r\n        .build( );\r\n\r\n      System.out.println( \"Registry Address = \" + config.getServerAddress( ) );\r\n\r\n    } catch ( Exception e ) {\r\n      System.err.println( \"Error in initializing dockerClient \" + e.getMessage( ) );\r\n      e.printStackTrace( );\r\n    }\r\n\r\n  }\r\n\r\n  public void searchDockerRepository( ) throws DockerException {\r\n    System.out.println( \"\\n\\nSEARCHING DOCKER REPOSITORY\" );\r\n    List< SearchItem > dockerSearch = dockerClient.searchImagesCmd( \"magento-ssh\" ).exec( );\r\n    System.out.println( \"Search returned\" );\r\n    System.out.println(\"DockerSearch = \" + dockerSearch);\r\n    for ( SearchItem searchItem : dockerSearch ) {\r\n      System.out.println( \"Description: \" + searchItem.getDescription( ) );\r\n      System.out.println( \"Name: \" + searchItem.getName( ) );\r\n      System.out.println( \"Official: \" + searchItem.isOfficial( ) + \"\\n\\n\" );\r\n    }\r\n\r\n  }\r\n\r\n  public void getDockerInfo( ) throws DockerException {\r\n    System.out.println( \"\\n\\nGETTING DOCKER INFO\" );\r\n    Info info = dockerClient.infoCmd( ).exec( );\r\n    System.out.print( info );\r\n  }\r\n\r\n  public void getDockerVersion( ) throws DockerException {\r\n    System.out.println( \"\\n\\nGETTING DOCKER VERSION\" );\r\n    Version version = dockerClient.versionCmd( ).exec( );\r\n    System.out.println( version.toString( ) );\r\n  }\r\n\r\n  /*public void createContainer( ) throws DockerException {\r\n\r\n    System.out.println( \"\\n\\nCREATE CONTAINER\" );\r\n\r\n    ContainerConfig containerConfig = new ContainerConfig( );\r\n    containerConfig.setImage( \"busybox\" );\r\n    containerConfig.setCmd( new String[]{ \"true\" } );\r\n\r\n    ContainerCreateResponse container = dockerClient.createContainer( containerConfig );\r\n    System.out.println( \"Created container \" + container.toString( ) + \"  id = \" + container.getId( ) );\r\n\r\n    dockerClient.startContainer( container.getId( ) );\r\n\r\n    ContainerInspectResponse containerInspectResponse = dockerClient.inspectContainer( container.getId( ) );\r\n    System.out.println( \"Container Inspect: \" + containerInspectResponse.toString( ) );\r\n  }*/\r\n\r\n  public void listImage( ) throws DockerException {\r\n\r\n    System.out.println( \"\\n\\nIMAGES\" );\r\n\r\n    List< Image > images = dockerClient.listImagesCmd( ).exec( );\r\n    //LOG.info ( \"Images List: \" + images );\r\n\r\n    int size = images.size( );\r\n\r\n    System.out.println( \"================> Images Count= \" + size + \" <==========================\" );\r\n\r\n    for ( Image img : images ) {\r\n      System.out.println( \"Created = \" + img.getCreated( ) );\r\n      System.out.println( \"Size = \" + img.getSize( ) );\r\n      System.out.println( \"Virtual Size = \" + img.getVirtualSize( ) );\r\n      System.out.println( \"Id = \" + img.getId( ) );\r\n      System.out.println( \"Tag = \" + img.getRepoTags( ) );\r\n\r\n      System.out.println( \"\\n\\n\\n\" );\r\n    }\r\n\r\n  }\r\n\r\n  public void listContainers( ) throws DockerException {\r\n\r\n    System.out.println( \"\\n\\nCONTAINERS\" );\r\n\r\n    List< Container > containers = dockerClient.listContainersCmd( ).exec( );\r\n    System.out.println( \"Container List: \" + containers );\r\n\r\n    int size = containers.size( );\r\n\r\n    System.out.println( \"Containers = \" + size );\r\n\r\n    for ( Container container : containers ) {\r\n      //System.out.println ( \"ID = \" + container.getId () + \" Image = \" + container.getImage () );\r\n      //dockerClient.startContainer ( container.getId ());\r\n      System.out.println( \"Container [ \" + container.getId( ) + \" ] => \" + container.toString( ) );\r\n    }\r\n  }\r\n}"}}