收藏
回答

使用官方的dockerfile文档部署springboot项目,一直失败,不知道什么原因?

[2023-04-12 22:35:23] [INFO] Building jar: /app/target/lib/myvideo_proj.jar

[2023-04-12 22:35:23] [INFO] ------------------------------------------------------------------------

[2023-04-12 22:35:23] [INFO] BUILD SUCCESS

[2023-04-12 22:35:23] [INFO] ------------------------------------------------------------------------

[2023-04-12 22:35:23] [INFO] Total time: 57.527 s

[2023-04-12 22:35:23] [INFO] Finished at: 2023-04-12T14:35:23Z

[2023-04-12 22:35:23] [INFO] ------------------------------------------------------------------------

[2023-04-12 22:35:24] Removing intermediate container b081272807d4

[2023-04-12 22:35:24] ---> 339f2fdfbf32

[2023-04-12 22:35:24] Step 6/16 : FROM alpine:3.13

[2023-04-12 22:35:25] 3.13: Pulling from library/alpine

[2023-04-12 22:35:25] 72cfd02ff4d0: Pulling fs layer

[2023-04-12 22:35:26] 72cfd02ff4d0: Verifying Checksum

[2023-04-12 22:35:26] 72cfd02ff4d0: Download complete

[2023-04-12 22:35:26] 72cfd02ff4d0: Pull complete

[2023-04-12 22:35:26] Digest: sha256:469b6e04ee185740477efa44ed5bdd64a07bbdd6c7e5f5d169e540889597b911

[2023-04-12 22:35:26] Status: Downloaded newer image for alpine:3.13

[2023-04-12 22:35:26] ---> 6b5c5e00213a

[2023-04-12 22:35:26] Step 7/16 : RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tencent.com/g' /etc/apk/repositories && apk add --update --no-cache openjdk8-jre-base && rm -f /var/cache/apk/*

[2023-04-12 22:35:26] ---> Running in 082d53752fc2

[2023-04-12 22:35:26] fetch https://mirrors.tencent.com/alpine/v3.13/main/x86_64/APKINDEX.tar.gz

[2023-04-12 22:35:27] fetch https://mirrors.tencent.com/alpine/v3.13/community/x86_64/APKINDEX.tar.gz

[2023-04-12 22:35:27] (1/23) Installing openjdk8-jre-lib (8.275.01-r0)

[2023-04-12 22:35:29] (2/23) Installing java-common (0.2-r0)

[2023-04-12 22:35:29] (3/23) Installing libffi (3.3-r2)

[2023-04-12 22:35:29] (4/23) Installing p11-kit (0.23.22-r0)

[2023-04-12 22:35:29] (5/23) Installing libtasn1 (4.16.0-r1)

[2023-04-12 22:35:29] (6/23) Installing p11-kit-trust (0.23.22-r0)

[2023-04-12 22:35:29] (7/23) Installing ca-certificates (20220614-r0)

[2023-04-12 22:35:29] (8/23) Installing java-cacerts (1.0-r1)

[2023-04-12 22:35:29] (9/23) Installing nspr (4.31-r0)

[2023-04-12 22:35:29] (10/23) Installing sqlite-libs (3.34.1-r0)

[2023-04-12 22:35:29] (11/23) Installing nss (3.68.4-r0)

[2023-04-12 22:35:30] (12/23) Installing libjpeg-turbo (2.1.0-r0)

[2023-04-12 22:35:30] (13/23) Installing krb5-conf (1.0-r2)

[2023-04-12 22:35:30] (14/23) Installing libcom_err (1.45.7-r0)

[2023-04-12 22:35:30] (15/23) Installing keyutils-libs (1.6.3-r0)

[2023-04-12 22:35:30] (16/23) Installing libverto (0.3.1-r1)

[2023-04-12 22:35:30] (17/23) Installing krb5-libs (1.18.5-r0)

[2023-04-12 22:35:30] (18/23) Installing lcms2 (2.11-r0)

[2023-04-12 22:35:30] (19/23) Installing pcsc-lite-libs (1.9.0-r0)

[2023-04-12 22:35:30] (20/23) Installing liblksctp (1.0.18-r1)

[2023-04-12 22:35:30] (21/23) Installing libgcc (10.2.1_pre1-r3)

[2023-04-12 22:35:30] (22/23) Installing libstdc++ (10.2.1_pre1-r3)

[2023-04-12 22:35:31] (23/23) Installing openjdk8-jre-base (8.275.01-r0)

[2023-04-12 22:35:31] Executing busybox-1.32.1-r9.trigger

[2023-04-12 22:35:31] Executing java-common-0.2-r0.trigger

[2023-04-12 22:35:31] Executing ca-certificates-20220614-r0.trigger

[2023-04-12 22:35:31] OK: 78 MiB in 37 packages

[2023-04-12 22:35:32] Removing intermediate container 082d53752fc2

[2023-04-12 22:35:32] ---> 10101fb646cb

[2023-04-12 22:35:32] Step 8/16 : RUN apk add ca-certificates

[2023-04-12 22:35:32] ---> Running in 5880b287e2f9

[2023-04-12 22:35:33] fetch https://mirrors.tencent.com/alpine/v3.13/main/x86_64/APKINDEX.tar.gz

[2023-04-12 22:35:33] fetch https://mirrors.tencent.com/alpine/v3.13/community/x86_64/APKINDEX.tar.gz

[2023-04-12 22:35:33] OK: 78 MiB in 37 packages

[2023-04-12 22:35:34] Removing intermediate container 5880b287e2f9

[2023-04-12 22:35:34] ---> 0c1a81c70b3b

[2023-04-12 22:35:34] Step 9/16 : WORKDIR /app

[2023-04-12 22:35:34] ---> Running in de269925ada3

[2023-04-12 22:35:34] Removing intermediate container de269925ada3

[2023-04-12 22:35:34] ---> 885d22f988ed

[2023-04-12 22:35:34] Step 10/16 : COPY --from=build /app/target/*.jar .

[2023-04-12 22:35:34] COPY failed: no source files were specified

[2023-04-12 22:35:34] [Pipeline] }

[2023-04-12 22:35:34] [Pipeline] // stage

[2023-04-12 22:35:34] [Pipeline] stage

[2023-04-12 22:35:34] [Pipeline] { (推送 Docker 镜像到 TCR)

[2023-04-12 22:35:34] Stage "推送 Docker 镜像到 TCR" skipped due to earlier failure(s)

[2023-04-12 22:35:34] [Pipeline] }

[2023-04-12 22:35:34] [Pipeline] // stage

[2023-04-12 22:35:34] [Pipeline] }

[2023-04-12 22:35:34] [Pipeline] // node

[2023-04-12 22:35:34] [Pipeline] End of Pipeline

[2023-04-12 22:35:34] ERROR: script returned exit code 1

[2023-04-12 22:35:34] Finished: FAILURE

***

-----------构建wangjunyi-pro-003-----------

2023-04-12 22:34:11 create_build_image : succ,


报错文件什么我看是正常建了jar包,然后 # 将构建产物jar包拷贝到运行时目录中 这一步没有文件,然后就部署失败;

我又在本地idea中试了一下,同样是这里卡住了


Step 9/16 : WORKDIR /app

 ---> Running in 296a584c11dd

Removing intermediate container 296a584c11dd

 ---> f15a2f0ef410

Step 10/16 : COPY --from=build /app/target/*.jar .

Error response from daemon: COPY failed: no source files were specified

Failed to deploy '<unknown> Dockerfile: Dockerfile': Can't retrieve image ID from build stream


回答关注问题邀请回答
收藏

2 个回答

  • White
    White
    2023-04-13

    [2023-04-13 20:24:23] Step 16/16 : CMD ["java", "-jar", "/app/myvideo-1.0.jar"]

    [2023-04-13 20:24:23] ---> Running in 2f1e6c688f9e

    [2023-04-13 20:24:23] Removing intermediate container 2f1e6c688f9e

    [2023-04-13 20:24:23] ---> f0b5dca1c366

    [2023-04-13 20:24:23] Successfully built f0b5dca1c366

    [2023-04-13 20:24:23] Successfully tagged ccr.ccs.tencentyun.com/tcb-******-jnzk/ca-fljcuies_wangjunyi-pro:wangjunyi-pro-004-20230413202317

    [2023-04-13 20:24:23] [Pipeline] }

    [2023-04-13 20:24:23] [Pipeline] // stage

    [2023-04-13 20:24:23] [Pipeline] stage

    [2023-04-13 20:24:23] [Pipeline] { (推送 Docker 镜像到 TCR)

    [2023-04-13 20:24:23] [Pipeline] sh

    [2023-04-13 20:24:24] + docker push ccr.ccs.tencentyun.com/tcb-******-jnzk/ca-fljcuies_wangjunyi-pro:wangjunyi-pro-004-20230413202317

    [2023-04-13 20:24:24] The push refers to repository [ccr.ccs.tencentyun.com/tcb-******-jnzk/ca-fljcuies_wangjunyi-pro]

    [2023-04-13 20:24:24] e5634aa607b5: Preparing

    [2023-04-13 20:24:24] a248e7dc8238: Preparing

    [2023-04-13 20:24:24] 8e1071413480: Preparing

    [2023-04-13 20:24:24] d378e0762229: Preparing

    [2023-04-13 20:24:24] 7df5bd7bd262: Preparing

    [2023-04-13 20:24:24] 7df5bd7bd262: Layer already exists

    [2023-04-13 20:24:25] a248e7dc8238: Pushed

    [2023-04-13 20:24:25] e5634aa607b5: Pushed

    [2023-04-13 20:24:26] 8e1071413480: Pushed

    [2023-04-13 20:24:53] d378e0762229: Pushed

    [2023-04-13 20:24:53] wangjunyi-pro-004-20230413202317: digest: sha256:f2c113baf9ba523527e8b669ef479c3e213e4c42f95be55b933c3fd9454c974a size: 1366

    [2023-04-13 20:24:53] [Pipeline] }

    [2023-04-13 20:24:53] [Pipeline] // stage

    [2023-04-13 20:24:53] [Pipeline] }

    [2023-04-13 20:24:53] [Pipeline] // node

    [2023-04-13 20:24:53] [Pipeline] End of Pipeline

    [2023-04-13 20:24:53] Finished: SUCCESS

    ***

    -----------构建wangjunyi-pro-004-----------

    2023-04-13 20:23:18 create_build_image : succ,

    2023-04-13 20:24:57 check_build_image : succ, ,

    -----------服务wangjunyi-pro部署wangjunyi-pro-004-----------

    2023-04-13 20:24:58 create_eks_virtual_service : succ,

    2023-04-13 20:24:58 check_eks_virtual_service : process, DescribeVersion_user_error_Back-off restarting failed container, [service]:[Exec lifecycle hook ([/bin/sh /app/cert/initenv.sh]) for Container "wangjunyi-pro-004" in Pod "wangjunyi-pro-004-7dc79cd977-n4nj6_gpdccrud(9f41f721-db19-46bb-b61b-8e0c8c15a6d5)" failed - error: rpc error: code = Unknown desc = failed to exec in container: failed to create exec "a30d720f31be3e9c26096968c9b4a8816c9a4496c381903cb7d2e9d7fe4b1265": cannot exec in a stopped state: unknown, message: "",Exec lifecycle hook ([/bin/sh /app/cert/initenv.sh]) for Container "wangjunyi-pro-004" in Pod "wangjunyi-pro-004-7dc79cd977-n4nj6_gpdccrud(9f41f721-db19-46bb-b61b-8e0c8c15a6d5)" failed - error: rpc error: code = Unknown desc = failed to exec in container: failed to create exec "fa709a882f703662318ba5e4f643211e5887bdf6f07e76d4e54a4da9c54feb3a": cannot exec in a stopped state: unknown, message: "",Back-off restarting failed container,]


    我在本地的docker中成功部署了,但是在云托管中最后会报错,如上。

    2023-04-13
    有用
    回复
  • showms
    showms
    2023-04-13

    你构建出来的jar是在这个目录吗?/app/target/lib/myvideo_proj.jar,看他的报错信息是

    COPY --from=build /app/target/*.jar,也就是构建出来的jar路径得是/app/target/myvideo_proj.jar


    不知道对不对,你可以尝试搞一下看看

    2023-04-13
    有用
    回复 2
    • White
      White
      2023-04-13
      成功了!确实是这个路径问题。但是最后构建了镜像以后还是报错了,又出现了新的问题。
      2023-04-13
      回复
    • showms
      showms
      2023-04-14回复White
      根据报错日志排查吧,应该都还好
      2023-04-14
      回复
登录 后发表内容
问题标签