Jenkins:构建和发布失败。被拒绝:请求访问资源被拒绝

问题描述 投票:0回答:1

我使用 Jenkins 和 Docker 构建了 CI/CD 管道。直到五天前,该管道都运行良好。但是当我今天尝试构建时,它给了我被拒绝:在推送步骤中请求对资源的访问被拒绝,并且我的构建失败了。

我在此期间所做的唯一重大更改是,我在五天前上次成功构建的同时更新了我的 docker 引擎。我只是不记得是在构建之前还是构建之后。

这是我上次成功构建的控制台输出:

WARNING: Support for the legacy ~/.dockercfg configuration file and file-format is deprecated and will be removed in an upcoming release
WARNING: Support for the legacy ~/.dockercfg configuration file and file-format is deprecated and will be removed in an upcoming release
Sending build context to Docker daemon  187.7MB

Step 1/4 : FROM openjdk:17
17: Pulling from library/openjdk
Digest: sha256:528707081fdb9562eb819128a9f85ae7fe000e2fbaeaf9f87662e7b3f38cb7d8
Status: Image is up to date for openjdk:17
 ---> 5e28ba2b4cdb
Step 2/4 : EXPOSE 8081
 ---> Using cache
 ---> a27a4f5b7102
Step 3/4 : ADD target/wordsmith-0.0.1-SNAPSHOT.war wordsmith-0.0.1-SNAPSHOT.war
 ---> 04ec132f968c
Step 4/4 : ENTRYPOINT [ "java", "-Dspring.profiles.active=prod","-jar","/wordsmith-0.0.1-SNAPSHOT.war" ]
 ---> Running in 39905ffa8a16
Removing intermediate container 39905ffa8a16
 ---> c3c19e91594c
Successfully built c3c19e91594c
Successfully tagged salahuddinshayan/wordsmith:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
WARNING: Support for the legacy ~/.dockercfg configuration file and file-format is deprecated and will be removed in an upcoming release

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
[wordsmith] $ docker inspect c3c19e91594c
WARNING: Support for the legacy ~/.dockercfg configuration file and file-format is deprecated and will be removed in an upcoming release
WARNING: Support for the legacy ~/.dockercfg configuration file and file-format is deprecated and will be removed in an upcoming release
[wordsmith] $ docker push salahuddinshayan/wordsmith
WARNING: Support for the legacy ~/.dockercfg configuration file and file-format is deprecated and will be removed in an upcoming release
WARNING: Support for the legacy ~/.dockercfg configuration file and file-format is deprecated and will be removed in an upcoming release
Using default tag: latest
The push refers to repository [docker.io/salahuddinshayan/wordsmith]
5451b19a11cb: Preparing
dc9fa3d8b576: Preparing
27ee19dc88f2: Preparing
c8dd97366670: Preparing
27ee19dc88f2: Layer already exists
c8dd97366670: Layer already exists
dc9fa3d8b576: Layer already exists
5451b19a11cb: Pushed
latest: digest: sha256:a1d6c888c1ed2e8a1e6a0d48246b85686e6d1f8549875899ea659b5be5cb95bd size: 1166
Finished: SUCCESS 

这是失败构建的控制台输出:

[wordsmith] $ docker build -t index.docker.io/salahuddinshayan/wordsmith --pull=true C:\ProgramData\Jenkins\.jenkins\workspace\wordsmith
#0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 232B 0.0s done
#1 DONE 0.0s

#2 [internal] load metadata for docker.io/library/openjdk:17
#2 DONE 0.9s

#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s

#4 [1/2] FROM docker.io/library/openjdk:17@sha256:528707081fdb9562eb819128a9f85ae7fe000e2fbaeaf9f87662e7b3f38cb7d8
#4 DONE 0.0s

#5 [internal] load build context
#5 transferring context: 69.81MB 2.4s done
#5 DONE 2.4s

#4 [1/2] FROM docker.io/library/openjdk:17@sha256:528707081fdb9562eb819128a9f85ae7fe000e2fbaeaf9f87662e7b3f38cb7d8
#4 CACHED

#6 [2/2] ADD target/wordsmith-0.0.1-SNAPSHOT.war wordsmith-0.0.1-SNAPSHOT.war
#6 DONE 0.2s

#7 exporting to image
#7 exporting layers
#7 exporting layers 0.2s done
#7 writing image sha256:208a62165e9bd213c2f4a0078d7ef863fbf72fba184129bd1e0fc5076b49c163 done
#7 naming to docker.io/salahuddinshayan/wordsmith done
#7 DONE 0.2s
[wordsmith] $ docker push index.docker.io/salahuddinshayan/wordsmith
Using default tag: latest
The push refers to repository [docker.io/salahuddinshayan/wordsmith]
efe61bd7c8af: Preparing
dc9fa3d8b576: Preparing
27ee19dc88f2: Preparing
c8dd97366670: Preparing
denied: requested access to the resource is denied
Build step 'Docker Build and Publish' marked build as failure
Finished: FAILURE

我尝试升级 Jenkins 及其插件,并且还仔细检查了我的 Docker hub 凭据,但没有任何帮助。

如果你们有任何想法如何摆脱这种混乱,我们将不胜感激。

docker jenkins
1个回答
0
投票

我认为重新验证应该有效。

docker logout
docker login

或者另一种解决方案可以是: 推或拉而不指定:

index.docker.io
docker.io

请跟随以下:

docker push salahuddinshayan/wordsmith:latest` 
© www.soinside.com 2019 - 2024. All rights reserved.