copy失败错误dockerfile

ivqmmu1c  于 2021-07-12  发布在  Java
关注(0)|答案(1)|浏览(615)

出现了一个奇怪的错误,这个代码在运行之前。
我的树:

LM0002254:SellerService$ ls -lrt
total 61512
drwxr-xr-x   3 tarun  826136866        96 Feb  8 14:16 gradle
-rw-r--r--   1 tarun  826136866       168 Apr 23 13:26 gradle.properties
-rwxr-xr-x   1 tarun  826136866      5766 Apr 23 13:26 gradlew
-rw-r--r--   1 tarun  826136866      2763 Apr 23 13:26 gradlew.bat
-rw-r--r--   1 tarun  826136866        36 Apr 23 13:26 settings.gradle.kts
drwxr-xr-x   5 tarun  826136866       160 Apr 23 13:26 src
-rw-r--r--   1 tarun  826136866      3868 Apr 23 22:39 build.gradle.kts
drwxr-xr-x  23 tarun  826136866       736 Apr 23 23:15 build
-rw-r--r--   1 tarun  826136866  31282686 Apr 23 23:16 SellerService-jvm-1.0-SNAPSHOT.jar
-rwxr-xr-x   1 tarun  826136866       214 Apr 23 23:22 install-cloud.sh
-rw-r--r--   1 tarun  826136866       148 Apr 23 23:39 Dockerfile

docker文件:

FROM openjdk:8-jre-alpine

WORKDIR /app
COPY SellerService-jvm-1.0-SNAPSHOT.jar ./

CMD ["java", "-jar", "./SellerService-jvm-1.0-SNAPSHOT.jar"]

我得到下面的错误,不知道为什么。这段代码昨天也在运行。
在gcloud上使用的cmd。

gcloud builds submit --tag gcr.io/<projectname>

获取时出错:

Step 1/5 : FROM openjdk:8-jre-alpine
8-jre-alpine: Pulling from library/openjdk
e7c96db7181b: Already exists
f910a506b6cb: Already exists
b6abafe80f63: Pulling fs layer
b6abafe80f63: Verifying Checksum
b6abafe80f63: Download complete
b6abafe80f63: Pull complete
Digest: sha256:f362b165b870ef129cbe730f29065ff37399c0aa8bcab3e44b51c302938c9193
Status: Downloaded newer image for openjdk:8-jre-alpine
 ---> f7a292bbb70c
Step 2/5 : WORKDIR /app
 ---> Running in 76b0acf0c246
Removing intermediate container 76b0acf0c246
 ---> 4afe2649b879
Step 3/5 : COPY SellerService-jvm-1.0-SNAPSHOT.jar .
COPY failed: stat /var/lib/docker/tmp/docker-builder987483752/SellerService-jvm-1.0-SNAPSHOT.jar: no such file or directory
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1
3pmvbmvn

3pmvbmvn1#

docker正在读取我的.gitignore内容并忽略其中的文件和文件夹。我忽略了gitinore中的jar文件,所以在复制时忽略了它。需要确保.gitignore文件没有忽略您正在docker文件中复制的那些文件。

相关问题