gradle-docker icon indicating copy to clipboard operation
gradle-docker copied to clipboard

Require docker login when push=true

Open benfortuna opened this issue 7 years ago • 4 comments

It appears you need to run docker login prior to pushing to hub.docker.com.

Would it be possible to integrate this in the plugin? Currently push will fail with following error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':buildDocker'.
> Docker execution failed
  Command line [docker push image/example:1.0] returned:
  denied: requested access to the resource is denied

Task configuration is like this:

docker {
    baseImage "image/base:1"
}

task buildDocker(type: Docker) {
    applicationName = 'image/example'
    tagVersion = '1.0'
    push true
    apiUsername = username
    apiPassword = password
    apiEmail = [email protected]
}

I haven't tried with useApi=true as yet as that was giving a different error.

benfortuna avatar May 31 '18 13:05 benfortuna

Does it work if you perform docker login before running your build?

bjornmagnusson avatar Jun 02 '18 09:06 bjornmagnusson

Yes, can confirm if I run docker login first the push will be successful.

However if it can be integrated into the plugin it would save some trouble configuring automated builds.

benfortuna avatar Jun 02 '18 11:06 benfortuna

If you can provide an proposal on how to fix this, I would be prepared to take a look at it. Contributions are very welcome

bjornmagnusson avatar Jul 03 '18 20:07 bjornmagnusson

I'd be willing to help too bad I don't know much about developing gradle plugins, if I could get pointers I would try

jamesdube avatar Jan 09 '19 14:01 jamesdube