Open Dreampie opened 8 years ago
Please add some more information to ease understanding of your setup, such as your distDocker config in build.gradle.
task buildDocker(type: Docker, dependsOn: build) {
maintainer = "Dreampie <Dreampie@outlook.com>"
push = true
applicationName = jar.baseName
dockerfile = file("src/main/docker/Dockerfile")
registry = dockerRegistry
doFirst {
copy {
from jar
into stageDir
}
}
}
My registry in http://192.168.60.41:5000,but docker use https://192.168.60.41:5000。
docker-machine create --driver virtualbox --engine-insecure-registry 192.168.60.41:5000 dev
set insecure-registry must create new virtualbox,could not update?
I have run into the same problem when trying the plugin for the same time. Interestingly enough I am also trying to build an Eureka Server
In my case I have a multi-parent project where the folder structure is the following
ParentFolder
|
|___ build.gradle
|___ eurekaServer
|____ build.gradle
My parent build.gradle contains the following plugin configuration
allprojects {
group = "com.mycompany"
version = "1.0.0-SNAPSHOT"
task wrapper(type: Wrapper) {
gradleVersion = '2.11'
distributionUrl = 'http://services.gradle.org/distributions/gradle-2.11-all.zip'
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: "io.spring.dependency-management"
apply plugin: 'docker'
repositories {
mavenCentral()
}
dependencyManagement {
imports {
mavenBom 'org.springframework.cloud:spring-cloud-starter-parent:Angel.SR6'
}
}
dependencies {
compile('org.springframework.cloud:spring-cloud-starter-config')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
docker {
baseImage "java:8"
}
task buildDocker(type: Docker, dependsOn: build) {
push = false
applicationName = jar.baseName
volume "/tmp"
addFile {
from jar
rename {'app.jar'}
}
runCommand "bash -c 'touch /app.jar'"
entryPoint(['java', '-Djava.security.egd=file:/dev/./urandom', '-jar', '/app.jar'])
}
}
And the eurekaServer build.gradle is setup this way
jar {
baseName = 'eurekaserver'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile('org.springframework.cloud:spring-cloud-starter-eureka-server')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
Now here is the interesting part. I actually have a few more children applications under the parentFolder and they build without any problems but the eureka server does not and spits out the following error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':eurekaServer:buildDocker'.
> Docker execution failed
Command line [docker build -t com.mycompany/eurekaServer:1.0.0-SNAPSHOT /some/folder/eurekaServer/build/docker] returned:
invalid value "com.mycompany/eurekaServer:1.0.0-SNAPSHOT" for flag -t: Error parsing reference: "com.mycompany/eurekaServer:1.0.0-SNAPSHOT" is not a valid repository/tag
See 'docker build --help'.
Notice that for some reason it is using the folder name which has came case (eurekaServer) instead of the actual configured applicationName in the parent which is set to jar.basename and the jar baseName is not camel case (eurekaserver).
My other children projects which build without any errors do not have camel case so to test I changed one of their folder names to came case and sure enough I got the same error there as well. The plugin seems to be ignoring the applicationname setting in the parent
Could this be the same issue at play here or should I maybe open up a new issue?
registry=http://192.168.60.41:5000
registry=192.168.60.41:5000
docker-registry in http not https