2016-07-08 59 views
0

我想这Spring boot with docket example使用摇篮,但得到上运行gradle build buildDocker错误推泊坞窗图像dockerhub使用gradle这个

C:\Users\zeeshan\Workspace\MyWorkspace\SpringBootDocker>gradle build buildDocker 
: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'. 
> java.io.IOException: Cannot run program "docker": CreateProcess error=2, The system cannot find the file specified 

* 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: 10.092 secs 

的Docketfile存在的src \在我的Windows机器的主要\泊坞窗任务以下错误。

的build.gradle文件:

buildscript { 
    repositories { 
     maven { url "${nexusUrl}/content/groups/public" } 
     mavenCentral() 
    } 
    dependencies { 
     classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.5.RELEASE") 
     classpath('se.transmode.gradle:gradle-docker:1.2') 
    } 
} 

group = 'mydockergroup' 

apply plugin: 'java' 
apply plugin: 'eclipse' 
apply plugin: 'idea' 
apply plugin: 'spring-boot' 
apply plugin: 'docker' 

jar { 
    baseName = 'gs-spring-boot-docker' 
    version = '0.1.0' 
} 

repositories { 
    maven { url "${nexusUrl}/content/groups/public" } 
    mavenCentral() 
} 

sourceCompatibility = 1.8 
targetCompatibility = 1.8 

dependencies { 
    compile("org.springframework.boot:spring-boot-starter-web") 
    testCompile("org.springframework.boot:spring-boot-starter-test") 
} 

task wrapper(type: Wrapper) { 
    gradleVersion = '2.3' 
} 

task buildDocker(type: Docker, dependsOn: build) { 
    push = true 
    applicationName = jar.baseName 
    dockerfile = file('src/main/docker/Dockerfile') 
    doFirst { 
    copy { 
     from jar 
     into stageDir 
    } 
    } 
} 

注:我复制我的工作区在Ubuntu系统,它能正常工作。在我的build.gradle for Windows系统中为dockerfile设置文件路径时有问题吗?

回答

0

我们在docker-maven-plugin中指定了dockerDirectory。我认为你可能需要在gradle中设置类似。

<dockerDirectory>${basedir}/docker</dockerDirectory>