Jenkins 管道中的 Dockerfile 入口点失败

时间:2021-02-25 23:40:50

标签: docker jenkins dockerfile jenkins-pipeline terraform

Jenkins Dockerfile 代理如何工作?

我已经将我的 Dockerfile 定义为

FROM hashicorp/terraform:latest
ENTRYPOINT ["terraform"]

我的 Jenkinsfile 为

pipeline {
    agent { 
        dockerfile true
    }
    stages {
        stage('Example') {
            steps {
                sh 'terraform version'
            }
        }
    }
    post { 
        always { 
            cleanWs()
        }
    }
}

但我一直在控制台输出中收到错误,要求我检查我的 ENTRYPOINT

错误信息:

ERROR: The container started but didn't run the expected command. Please double check your ENTRYPOINT does execute the command passed as docker run argument, as required by official docker images (see https://github.com/docker-library/official-images#consistency for entrypoint consistency requirements).
Alternatively you can force image entrypoint to be disabled by adding option `--entrypoint=''`.

我查看了 documentation,但似乎无法理解。

我期望发生的是 Jenkins 将构建 hashicorp/terraform 图像,然后我可以将其用作构建代理,而无需在我的服务器上安装 terraform,但我似乎做错了什么。

有人了解这是如何工作的吗?

0 个答案:

没有答案