gradle-docker-plugin: Unable to connect to private docker registry

I work in a restricted environment so I cannot access docker hub so I have attempted to setup my gradle build pointing to our private registry but the plugin seems to keep wanting to use docker hub?

I get the following error

Could not build image: Get https://index.docker.io/v1/repositories/frolvlad/alpine-oraclejdk8/images: dial tcp 52.22.190.106:443: connection refused

here is my docker gradle config

docker {
  url = 'tcp://appleby.test.austrac.gov.au:2376'

  registryCredentials {
    url = 'tcp://cdiregistry.test.austrac.gov.au'
  }
}

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16

Most upvoted comments

  1. Spring boot application are working perfectly with docker-java-application. Here’s an example of setup https://github.com/eshepelyuk/CodeForBlog/blob/master/SpringBootZuulAuth/build.gradle
  2. You should are --insecure-registry to your local Docker Engine options, i.e. to one that you’re configuring with docker.url property.

I hope I’ll find some time to take a look at it.

You could do one of the following

  • Download image locally and retag it
$ docker pull cdiregistry.test.austrac.gov.au/frolvlad/alpine-oraclejdk8:slim
$ docker tag cdiregistry.test.austrac.gov.au/frolvlad/alpine-oraclejdk8:slim frolvlad/alpine-oraclejdk8:slim
  • or adjust build.gradle like
task createDockerfile(type: Dockerfile) {
  ...  
  from 'cdiregistry.test.austrac.gov.au/frolvlad/alpine-oraclejdk8:slim'
}

PS

I’d suggest you to try docker-java-application (2nd plugin available in JAR) instead of too low-level docker-remote-api. You could avoid creating boilerplate tasks (Dockerfile generation, docker image build etc), since docker-java-application already provides them