2017-06-11 1 views
0

mit Ich versuche, Setup https://spring.io/guides/gs/spring-boot-docker/#initial mit meiner Umgebung, die einen privaten Registry-Server hat @Wie Docker mit gradle verwenden, während der private Docker Registrierungsserver

el-qa-docker.x.x.x:18445 

meine build.gradle hat folgende relevante Inhalte:

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 
    } 
    } 
} 

wenn ich laufe: $gradle build buildDock

ich AUSFALL bekommen bauen, mit:

$ 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 

Irgendwelche Ideen, wo gebe ich docker interne Registry an, die mit Gradle verwendet werden kann.

Ich habe versucht:

docker { 
    useApi true 
    hostUrl 'el-qa-docker.x.x.x:18445' 
    apiUsername 'james' 
} 

als zur Verfügung gestellt von https://github.com/Transmode/gradle-docker

aber das gibt einen anderen Fehler:

$ 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 

Ich habe versucht: build.gradle

docker { 
    //useApi true 
    hostUrl 'el2-dt-docker.uscis.dhs.gov:18445' 
    apiUsername 'skahmed' 
} 

und

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 
    } 
    } 
} 

aber erhalten:

: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 

Antwort

1

Sie können Ihre privaten Docker Registrierung als Teil Ihres Docker Bildnamen zB angeben:

el-qa-docker.x.x.x:18445/skahmed/gs-spring-boot-docker 

Bitte stellen Sie sicher, dass Ihr Docker-Daemon ist sich bewusst über private Registrierung.

+0

Wo würde ich diese Registrierung angeben? in der Dockerfile oder build.gradle? In der Task buildDocker() habe ich push = false geändert und den Build funktioniert, aber ich kann immer noch nicht zu meiner lokalen Registry gehen – kamal

Verwandte Themen