在Docker容器中制作目标的规则是什么?

时间:2018-05-04 23:56:24

标签: docker jenkins

要了解如何在Jenkins中操作Docker镜像,我正在阅读this link

什么是制定目标的规则"在Docker?下面的简单示例是失败的,因为没有规则来制定目标"。这在Docker中意味着什么?

错误和触发错误的代码

上面链接中的Jenkinsfile中的sh 'make test'代码行在以下块中运行时抛出错误:

testImage.inside {
    sh "whoami"
    sh 'make test'
}

Jenkins在尝试解释sh 'make test'代码行时抛出的实际错误是:

make test— Shell Script<1s  
    [ple-dockere-containered-app-WWNVRTE6XFKMI4JPEVK2F2U3HOGDZICATW6XBFM2IQUW5PAG5FWA] Running shell script
    + make test
    make: *** No rule to make target 'test'.  Stop.

完整的Jenkinsfile是:

node {
    // Clean workspace before doing anything
    deleteDir()

    try {
        stage ('Clone') {
            checkout scm
        }
        stage ('Build') {

            def testImage = docker.build("test-image", "./app") 

            testImage.inside {
                sh "whoami"
                sh 'make test'
            }
        }
    } catch (err) {
        currentBuild.result = 'FAILED'
        throw err
    }
}

请注意,make test命令正在容器中运行

0 个答案:

没有答案