nacos运行报错-jar: file does not exist&Can‘t retrieve image ID from build stream

一、问题

Deploying 'nacos Dockerfile: ruoyi-visual/ruoyi-nacos/Dockerfile'…
Building image…
Preparing build context archive…
[==================================================>]211/211 files
Done

Sending build context to Docker daemon…
[==================================================>] 6.099MB
Done

Step 1/8 : FROM openjdk:11
 ---> 5505a9a39df1
Step 2/8 : MAINTAINER Lion Li
 ---> Using cache
 ---> eca0c2bdad4a
Step 3/8 : RUN mkdir -p /ruoyi/nacos
 ---> Using cache
 ---> be0c071dd7d6
Step 4/8 : WORKDIR /ruoyi/nacos
 ---> Using cache
 ---> 408180929007
Step 5/8 : EXPOSE 8848
 ---> Using cache
 ---> 1595df8aa2ff
Step 6/8 : ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms256m -Xmx512m"
 ---> Using cache
 ---> 899b953e7851
Step 7/8 : ADD ./target/ruoyi-nacos.jar ./app.jar
Error response from daemon: ADD failed: file not found in build context or excluded by .dockerignore: stat target/ruoyi-nacos.jar: file does not exist
Failed to deploy 'nacos Dockerfile: ruoyi-visual/ruoyi-nacos/Dockerfile': Can't retrieve image ID from build stream


报错截图:
在这里插入图片描述

二、解决

2.1 以管理员身份运行IDEA

在这里插入图片描述
在这里插入图片描述

2.2 检查对应的Dockfile文件的配置

检查ruoyi-nacos.jar相关内容是否配置有误:
在这里插入图片描述

2.3 maven操作

双击clean:
在这里插入图片描述
双击package:
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
already in use by container:
在这里插入图片描述
删除nacos containers改用docker compose 方式启动:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

nacos运行报错-jar: file does not exist&Can’t retrieve image ID from build stream 问题解决了。
这里又会报一个常见的错误: No DataSource set

nacos: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'memoryMonitor' defined in URL [jar:file:/ruoyi/nacos/app.jar!/BOOT-INF/lib/nacos-config-2.2.1.jar!/com/alibaba/nacos/config/server/monitor/MemoryMonitor.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'asyncNotifyService': Unsatisfied dependency expressed through field 'dumpService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'externalDumpService': Invocation of init method failed; nested exception is ErrCode:500, ErrMsg:Nacos Server did not start because dumpservice bean construction failure :
nacos: No DataSource set

在这里插入图片描述

三、参考资料

IntelliJ IDEA使用docker插件打包镜像的两种方法
微服务模块部署到Docker

猜你喜欢

转载自blog.csdn.net/qyfx123456/article/details/131152520
今日推荐