I am trying to setup https://spring.io/guides/gs/spring-boot-docker/#initial with my environment, which has a private registry server @
el-qa-docker.x.x.x:18445
my build.gradle has the following relevant content:
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.3.RELEASE")
classpath('se.transmode.gradle:gradle-docker:1.2')
classpath ('org.codehaus.groovy:groovy-backports-compat23:2.3.5')
}
group = 'james'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'docker'
task buildDocker(type: Docker, dependsOn: build) {
push = true
applicationName = jar.baseName
dockerfile = file('src/main/docker/Dockerfile')
doFirst {
copy {
from jar
into stageDir
}
}
}
when I run: $gradle build buildDock
I get build FAILURE, with:
$ gradle build buildDock
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:findMainClass
:jar
:bootRepackage
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build
:buildDocker FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':buildDocker'.
> Docker execution failed
Command line [docker build -t skahmed/gs-spring-boot-docker:latest /Users/skahmed/devops/TOOLS/DOCKER/gs-spring-boot-docker/initial/build/docker] returned:
Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 16.243 secs
any ideas, on where do I specify docker's internal registry which can be used with Gradle.
I tried:
docker {
useApi true
hostUrl 'el-qa-docker.x.x.x:18445'
apiUsername 'james'
}
as provided by https://github.com/Transmode/gradle-docker
but that gives a different error:
$ gradle build buildDock
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:findMainClass
:jar
:bootRepackage
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build
:buildDocker FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':buildDocker'.
> Port is invalid: -1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1.389 secs
I tried : build.gradle
docker {
//useApi true
hostUrl 'el2-dt-docker.uscis.dhs.gov:18445'
apiUsername 'skahmed'
}
and
task buildDocker(type: Docker, dependsOn: build) {
push = true
applicationName = jar.baseName
//applicationName = 'el2-dt-docker.uscis.dhs.gov:18445/skahmed/gs-spring-boot-docker'
//applicationName = 'gs-spring-boot-docker'
dockerfile = file('src/main/docker/Dockerfile')
doFirst {
copy {
from jar
into stageDir
}
}
}
but get:
:buildDocker FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':buildDocker'.
> Docker execution failed
Command line [docker push skahmed/gs-spring-boot-docker:latest] returned:
Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
You can specify your private Docker registry as part of your Docker image name e.g.:
el-qa-docker.x.x.x:18445/skahmed/gs-spring-boot-docker
Please make sure your Docker daemon is aware about private registry.