2

I'm using docker-java to create an image on a docker host which is running on a Ubuntu 16.04 VM. The image creation works just fine and I can list the image created via docker-java. But when I try to push the image to a private registry(Harbor) I get

com.github.dockerjava.api.exception.DockerClientException: Could not push image: denied: requested access to the resource is denied

I have added my current user to the usergroup docker and can manually push the image with the following command from the terminal(note no sudo).

docker login
docker push some_ip/app/test:test

But when I make the following call from my java code I get the above mentioned error.

dockerClient.pushImageCmd("10.107.173.190/container-apps/test:testapp")                  
                    .exec(pushImageResultCallback).awaitSuccess();

Possible cues:

  • Which profile does docker daemon use when being invoked by the API? How can I make sure it has sufficient access?
Vivek Shankar
  • 770
  • 1
  • 15
  • 37
  • Did you use `.withRegistryUrl("https://10.107.173.190/v2/") .withRegistryUsername("user") .withRegistryPassword("pass")` while creating the dockerClient? – Tarun Lalwani Sep 28 '17 at 21:01
  • Yes I did.. I actually solved this problem by refering to an [open issue](https://github.com/docker-java/docker-java/issues/870) regarding this on their github repo.. – Vivek Shankar Sep 29 '17 at 10:49

0 Answers0