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

1. Problems

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


Error screenshot:
insert image description here

Two, solve

2.1 Run IDEA as administrator

insert image description here
insert image description here

2.2 Check the configuration of the corresponding Dockfile file

Check whether the related content of ruoyi-nacos.jar is misconfigured:
insert image description here

2.3 maven operation

Double-click clean:
insert image description here
Double-click package:
insert image description here

insert image description here

insert image description here

insert image description here
insert image description here
already in use by container:
insert image description here
delete nacos containers and use docker compose to start:
insert image description here
insert image description here
insert image description here
insert image description here

nacos running error-jar: file does not exist&Can't retrieve image ID from build stream The problem is solved.
A common error will be reported here: 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

insert image description here

3. Reference materials

IntelliJ IDEA uses the docker plug-in to package images in two ways
Microservice modules are deployed to Docker

Guess you like

Origin blog.csdn.net/qyfx123456/article/details/131152520