{"action":"created","issue":{"url":"https://api.github.com/repos/docker-java/docker-java/issues/691","repository_url":"https://api.github.com/repos/docker-java/docker-java","labels_url":"https://api.github.com/repos/docker-java/docker-java/issues/691/labels{/name}","comments_url":"https://api.github.com/repos/docker-java/docker-java/issues/691/comments","events_url":"https://api.github.com/repos/docker-java/docker-java/issues/691/events","html_url":"https://github.com/docker-java/docker-java/issues/691","id":174847061,"number":691,"title":"Pulling image with authentication fails with UnauthorizedException","user":{"login":"benash","id":237000,"avatar_url":"https://avatars.githubusercontent.com/u/237000?v=3","gravatar_id":"","url":"https://api.github.com/users/benash","html_url":"https://github.com/benash","followers_url":"https://api.github.com/users/benash/followers","following_url":"https://api.github.com/users/benash/following{/other_user}","gists_url":"https://api.github.com/users/benash/gists{/gist_id}","starred_url":"https://api.github.com/users/benash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benash/subscriptions","organizations_url":"https://api.github.com/users/benash/orgs","repos_url":"https://api.github.com/users/benash/repos","events_url":"https://api.github.com/users/benash/events{/privacy}","received_events_url":"https://api.github.com/users/benash/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/docker-java/docker-java/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2016-09-02T21:01:42Z","updated_at":"2016-09-09T18:08:24Z","closed_at":null,"body":"Thanks for the work on this project.\r\n\r\nI haven't been able to pull an image from our internal registry. With the following setup:\r\n```java\r\nAuthConfig authConfig = new AuthConfig()\r\n        .withUsername(\"developer\")\r\n        .withPassword(\"myPassword\")\r\n        .withEmail(\"ben@me.com\")\r\n        .withRegistryAddress(\"my-registry.com\");\r\nDefaultDockerClientConfig.Builder builder = DefaultDockerClientConfig.createDefaultConfigBuilder();\r\nDockerClient dockerClient = DockerClientBuilder.getInstance(builder.build())\r\n        .withDockerCmdExecFactory(dockerCmdExecFactory)\r\n        .build();\r\n```\r\n\r\nThis auth command succeeds, but the pull command fails:\r\n```java\r\ndockerClient.authCmd().withAuthConfig(authConfig).exec(); // WORKS\r\n\r\ndockerClient.pullImageCmd(\"my-registry.com/cassandra\") // FAILS\r\n        .withTag(\"latest\")\r\n        .withAuthConfig(authConfig)\r\n        .exec(new PullImageResultCallback()).awaitSuccess();\r\n```\r\n```\r\n16:35:36.827 DEBUG c.g.d.j.JerseyDockerCmdExecFactory - 3 * Sending client request on thread dockerjava-jaxrs-async-0\r\n3 > POST https://192.168.99.100:2376/images/create?fromImage=my-registry.com%2Fcassandra&tag=latest\r\n3 > Accept: application/octet-stream\r\n3 > Content-Type: application/json\r\n3 > X-Registry-Auth: (removed)\r\n16:35:36.830 DEBUG c.g.d.j.JerseyDockerCmdExecFactory$1 - Connection request: [route: {s}->https://192.168.99.100:2376][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]\r\n16:35:36.830 DEBUG c.g.d.j.JerseyDockerCmdExecFactory$1 - Connection leased: [id: 2][route: {s}->https://192.168.99.100:2376][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]\r\n16:35:36.830 DEBUG o.a.h.i.c.DefaultHttpClientConnectionOperator - Connecting to /192.168.99.100:2376\r\n16:35:36.852 DEBUG o.a.h.i.c.DefaultHttpClientConnectionOperator - Connection established 192.168.99.1:57454<->192.168.99.100:2376\r\n16:35:37.801 DEBUG o.a.h.i.c.DefaultManagedHttpClientConnection - http-outgoing-2: Shutdown connection\r\n16:35:37.803 DEBUG o.a.h.i.c.DefaultManagedHttpClientConnection - http-outgoing-2: Close connection\r\n16:35:37.803 DEBUG c.g.d.j.JerseyDockerCmdExecFactory$1 - Connection released: [id: 2][route: {s}->https://192.168.99.100:2376][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]\r\n16:35:37.806 ERROR c.g.d.c.async.ResultCallbackTemplate - Error during callback\r\ncom.github.dockerjava.api.exception.UnauthorizedException: {\"message\":\"Get https://my-registry.com/v2/cassandra/manifests/latest: unauthorized: authentication required\"}\r\n\tat com.github.dockerjava.jaxrs.filter.ResponseStatusExceptionFilter.filter(ResponseStatusExceptionFilter.java:45)\r\n\tat org.glassfish.jersey.client.ClientFilteringStages$ResponseFilterStage.apply(ClientFilteringStages.java:140)\r\n\tat org.glassfish.jersey.client.ClientFilteringStages$ResponseFilterStage.apply(ClientFilteringStages.java:128)\r\n```\r\n\r\nWhereas I can pull fine with the CLI:\r\n```\r\n» docker pull my-registry.com/cassandra\r\nUsing default tag: latest\r\nlatest: Pulling from cassandra\r\nDigest: sha256:f95931d0efbde34e438c127f6a7494c589ea3a45cead9025d75bbc120bd47935\r\nStatus: Image is up to date for my-registry.com/cassandra:latest\r\n```\r\n\r\nI decoded the `X-Registry-Auth` header that was sent with the POST request and, that seems to look correct:\r\n```json\r\n{\"username\":\"developer\",\"password\":\"myPassword\",\"email\":\"ben@me.com\",\"serveraddress\":\"my-registry.com\"}\r\n```\r\n\r\nHow could I further troubleshoot this issue?"},"comment":{"url":"https://api.github.com/repos/docker-java/docker-java/issues/comments/245993141","html_url":"https://github.com/docker-java/docker-java/issues/691#issuecomment-245993141","issue_url":"https://api.github.com/repos/docker-java/docker-java/issues/691","id":245993141,"user":{"login":"KostyaSha","id":231611,"avatar_url":"https://avatars.githubusercontent.com/u/231611?v=3","gravatar_id":"","url":"https://api.github.com/users/KostyaSha","html_url":"https://github.com/KostyaSha","followers_url":"https://api.github.com/users/KostyaSha/followers","following_url":"https://api.github.com/users/KostyaSha/following{/other_user}","gists_url":"https://api.github.com/users/KostyaSha/gists{/gist_id}","starred_url":"https://api.github.com/users/KostyaSha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KostyaSha/subscriptions","organizations_url":"https://api.github.com/users/KostyaSha/orgs","repos_url":"https://api.github.com/users/KostyaSha/repos","events_url":"https://api.github.com/users/KostyaSha/events{/privacy}","received_events_url":"https://api.github.com/users/KostyaSha/received_events","type":"User","site_admin":false},"created_at":"2016-09-09T18:08:24Z","updated_at":"2016-09-09T18:08:24Z","body":"https://travis-ci.org/docker-java/docker-java/builds/158802442 experimental and testing should install latest versions (even more than 1.12.1) so let's wait for results!"}}
{"actor":{"display_login":"KostyaSha"}}