简体   繁体   English

我无法通过 docker 映像启动我的 API

[英]I can't launch my API through the docker image

I downloaded a docker image of an API made in java that I hosted on the docker hub:我下载了一个在 docker hub 上托管的用 java 制作的 API 的 docker 镜像:

docker pull claubermartins/back-crud-spring:2.0

When I created the container and I try to run the API, I got the following warning after the code:当我创建容器并尝试运行 API 时,代码后出现以下警告:

docker run claubermartins/back-crud-spring: 2.0

"Error: Unable to access jarfile backCrudSpring.jar" “错误:无法访问 jarfile backCrudSpring.jar”

The Dockerfile used to build the image:用于构建镜像的 Dockerfile:

FROM adoptopenjdk/openjdk11:alpine-jre
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} backCrudSpring.jar
ENTRYPOINT ["java","-jar","backCrudSpring.jar"]

After the suggestions I typed the code docker run --entrypoint ls --rm claubermartins/back-crud-spring:2.0 and verified that the name of the .jar file was wrong.根据建议,我输入了代码docker run --entrypoint ls --rm claubermartins/back-crud-spring:2.0并验证 .jar 文件的名称是错误的。

To confirm I generated a new image and uploaded it to the docker hub docker build -t claubermartins/back-crud-spring:3.0 .为了确认我生成了一个新图像并将其上传到 docker hub docker build -t claubermartins/back-crud-spring:3.0 . and it works perfectly with the command docker run claubermartins/back-crud-spring:3.0 .它与命令docker run claubermartins/back-crud-spring:3.0完美配合。

Concluding as soon as I uploaded the image with a different Dockerfile to the Hub.当我将带有不同 Dockerfile 的图像上传到 Hub 时,我就得出了结论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM