{"action":"closed","issue":{"url":"https://api.github.com/repos/jenkinsci/docker-plugin/issues/315","labels_url":"https://api.github.com/repos/jenkinsci/docker-plugin/issues/315/labels{/name}","comments_url":"https://api.github.com/repos/jenkinsci/docker-plugin/issues/315/comments","events_url":"https://api.github.com/repos/jenkinsci/docker-plugin/issues/315/events","html_url":"https://github.com/jenkinsci/docker-plugin/issues/315","id":104495504,"number":315,"title":"NPE during DockerCloud.pullImage(..)","user":{"login":"Jotschi","id":326605,"avatar_url":"https://avatars.githubusercontent.com/u/326605?v=3","gravatar_id":"","url":"https://api.github.com/users/Jotschi","html_url":"https://github.com/Jotschi","followers_url":"https://api.github.com/users/Jotschi/followers","following_url":"https://api.github.com/users/Jotschi/following{/other_user}","gists_url":"https://api.github.com/users/Jotschi/gists{/gist_id}","starred_url":"https://api.github.com/users/Jotschi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jotschi/subscriptions","organizations_url":"https://api.github.com/users/Jotschi/orgs","repos_url":"https://api.github.com/users/Jotschi/repos","events_url":"https://api.github.com/users/Jotschi/events{/privacy}","received_events_url":"https://api.github.com/users/Jotschi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-09-02T14:38:29Z","updated_at":"2015-09-04T08:42:49Z","closed_at":"2015-09-04T08:42:49Z","body":"* Jenkins Version: 1.627\r\n* Docker Plugin: 0.13.0\r\n* Docker Host Version:\r\n```\r\nClient version: 1.6.2\r\nClient API version: 1.18\r\nGo version (client): go1.3.3\r\nGit commit (client): 7c8fca2\r\nOS/Arch (client): linux/amd64\r\nServer version: 1.6.2\r\nServer API version: 1.18\r\nGo version (server): go1.3.3\r\nGit commit (server): 7c8fca2\r\nOS/Arch (server): linux/amd64\r\n```\r\n\r\nI'm seeing this NPE when trying to start a docker slave:\r\n```\r\nSEVERE: Error in provisioning; template='DockerTemplate{configVersion=2, labelString='dockerSlave', launcher=com.nirima.jenkins.plugins.docker.launcher.DockerComputerSSHLauncher@3d93595b, remoteFsMapping='', remoteFs='/home/jenkins', instanceCap=1, mode=EXCLUSIVE, retentionStrategy=com.nirima.jenkins.plugins.docker.strategy.DockerOnceRetentionStrategy@4421368a, numExecutors=1, dockerTemplateBase=DockerTemplateBase{image=jenkins-1}, removeVolumes=false, pullStrategy=PULL_LATEST}' for cloud='satan3'\r\njava.lang.NullPointerException\r\n        at java.util.Arrays$ArrayList.<init>(Arrays.java:2842)\r\n        at java.util.Arrays.asList(Arrays.java:2828)\r\n        at com.nirima.jenkins.plugins.docker.DockerCloud$2.apply(DockerCloud.java:322)\r\n        at com.nirima.jenkins.plugins.docker.DockerCloud$2.apply(DockerCloud.java:319)\r\n        at shaded.com.google.common.collect.Iterators.indexOf(Iterators.java:778)\r\n        at shaded.com.google.common.collect.Iterators.any(Iterators.java:684)\r\n        at shaded.com.google.common.collect.Iterables.any(Iterables.java:623)\r\n        at com.nirima.jenkins.plugins.docker.DockerCloud.pullImage(DockerCloud.java:319)\r\n        at com.nirima.jenkins.plugins.docker.DockerCloud.provisionWithWait(DockerCloud.java:343)\r\n        at com.nirima.jenkins.plugins.docker.DockerCloud.access$000(DockerCloud.java:58)\r\n        at com.nirima.jenkins.plugins.docker.DockerCloud$1.call(DockerCloud.java:233)\r\n        at com.nirima.jenkins.plugins.docker.DockerCloud$1.call(DockerCloud.java:230)\r\n        at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)\r\n        at java.util.concurrent.FutureTask.run(FutureTask.java:262)\r\n        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)\r\n        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)\r\n        at java.lang.Thread.run(Thread.java:744)\r\n```\r\n\r\nI assume the used docker client is not able to deserialize the tags field within the JSON response.\r\nMy docker host returns this JSON to the Docker Plugin:\r\n\r\n```json\r\nGET /v1.6.2/images/json?all=0 HTTP/1.1\r\nAccept: application/json\r\nUser-Agent: Jersey/2.11 (Apache HttpClient 4.3.1)\r\nHost: docker:2375\r\nConnection: Keep-Alive\r\nAccept-Encoding: gzip,deflate\r\n\r\nHTTP/1.1 200 OK\r\nContent-Type: application/json\r\nDate: Wed, 02 Sep 2015 14:17:46 GMT\r\nContent-Length: 516\r\n\r\n[{\"Created\":1440101955,\"Id\":\"0653fde0f5c45dc51d3f1cf944b0013f8ca3797bcca654c9d81d3c29c42ed242\",\"Repository\":\"debian\",\"Size\":0,\"Tag\":\"stable\",\"VirtualSize\":125193302}\r\n,{\"Created\":1419452556,\"Id\":\"8880612971b0e41ecc5de6943c9680bb8dc08027dbae4d3a275ac827293cbf2e\",\"Repository\":\"evarga/jenkins-slave\",\"Size\":0,\"Tag\":\"latest\",\"VirtualSize\":610837147}\r\n,{\"Created\":1419452556,\"Id\":\"8880612971b0e41ecc5de6943c9680bb8dc08027dbae4d3a275ac827293cbf2e\",\"Repository\":\"jenkins-1\",\"Size\":0,\"Tag\":\"latest\",\"VirtualSize\":610837147}\r\n]\r\n```\r\n\r\nI assume image.getRepoTags() is returning null. The docker server overview also lists no tags for my docker images.\r\n\r\n```\r\n$ docker images \r\nREPOSITORY             TAG                 IMAGE ID            CREATED             VIRTUAL SIZE\r\ndebian                 stable              0653fde0f5c4        12 days ago         125.2 MB\r\nevarga/jenkins-slave   latest              8880612971b0        8 months ago        610.8 MB\r\njenkins-1              latest              8880612971b0        8 months ago        610.8 MB\r\n```\r\n\r\n```\r\n    private void pullImage(DockerTemplate dockerTemplate)  throws IOException {\r\n        final String imageName = dockerTemplate.getDockerTemplateBase().getImage();\r\n\r\n        List<Image> images = getClient().listImagesCmd().exec();\r\n\r\n        NameParser.ReposTag repostag = NameParser.parseRepositoryTag(imageName);\r\n        // if image was specified without tag, then treat as latest\r\n        final String fullImageName = repostag.repos + \":\" + (repostag.tag.isEmpty() ? \"latest\" : repostag.tag);\r\n\r\n        boolean imageExists = Iterables.any(images, new Predicate<Image>() {\r\n            @Override\r\n            public boolean apply(Image image) {\r\n                return Arrays.asList(image.getRepoTags()).contains(fullImageName);\r\n            }\r\n        });\r\n```"}}