运行Docker映像时无法访问jarfile [英] Unable to access jarfile when running Docker image

查看:1023
本文介绍了运行Docker映像时无法访问jarfile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Spring Boot Microservices和Docker的新手。

I am novice to Spring Boot Microservices and Docker.

微服务项目中的dockerfile:

The dockerfile in microservice project:

docker build:

docker build:

docker图像:

运行图像时,出现错误:无法访问jarfile register_server.jar

when running the image, there is an error: Unable to access jarfile register_server.jar

干杯,
肖恩

推荐答案

您需要指定绝对目标路径或设置 WORKDIR

You need to specify either the absolute target path or set the WORKDIR

https://docs.docker.com/engine/reference/builder/#add

< ; dest> 是绝对路径,或相对于 WORKDIR 的路径,源将复制到目标容器内。例如:

The <dest> is an absolute path, or a path relative to WORKDIR, into which the source will be copied inside the destination container. For example:

ADD test relativeDir/          # adds "test" to `WORKDIR`/relativeDir/
ADD test /absoluteDir/         # adds "test" to /absoluteDir/ 

这篇关于运行Docker映像时无法访问jarfile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆