我需要有关 Jenkinsfile CI 文件的帮助。
Jenknsfile 中的代码如下所示:
pipeline {
environment {
registry = "user/demo1"
registryCredential = 'dockerhub'
dockerImage = ''
}
agent any
stages {
stage('Building image') {
steps{
script {
dockerImage = docker.build registry + ":$BUILD_NUMBER"
}
}
}
stage('Container Image') {
steps{
script {
sh 'echo "docker.io/user/demo1 `pwd`/Dockerfile" > anchore_images'
anchore name: 'anchore_images'
}
}
}
stage('Deploy Image') {
steps{
script {
docker.withRegistry( 'https://registry.hub.docker.com', registryCredential ) {
dockerImage.push()
}
}
}
}
}
}
在我包含此阶段后,当容器映像阶段不存在时,它运行良好。它一直运行到构建阶段,然后失败。
这是错误的输出:
2021-05-05T09:36:31.884 INFO AnchoreWorker Submitting docker.io/user/demo1 for analysis
2021-05-05T09:36:41.630 ERROR AnchoreWorker anchore-engine add image failed. URL: http://localhost:8228/v1/images, status: HTTP/1.1 400 BAD REQUEST, error: {
"detail": {
"error_codes": [
"REGISTRY_IMAGE_NOT_FOUND"
],
"raw_exception_message": "Error encountered in skopeo operation. cmd=/bin/sh -c skopeo inspect --raw --tls-verify=false docker://docker.io/user/demo1:latest, rc=1, stdout=None, stderr=b'time=\"2021-05-05T09:36:37Z\" level=fatal msg=\"Error parsing image name \\\\\"docker://docker.io/user/demo1:latest\\\\\": Error reading manifest latest in docker.io/user/demo1: manifest unknown: manifest unknown\"\\n', error_code=REGISTRY_IMAGE_NOT_FOUND"
},
"httpcode": 400,
"message": "cannot fetch image digest/manifest from registry"
}
请帮我解决这个问题。