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:
Two, solve
2.1 Run IDEA as administrator
2.2 Check the configuration of the corresponding Dockfile file
Check whether the related content of ruoyi-nacos.jar is misconfigured:
2.3 maven operation
Double-click clean:
Double-click package:
already in use by container:
delete nacos containers and use docker compose to start:
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
3. Reference materials
IntelliJ IDEA uses the docker plug-in to package images in two ways
Microservice modules are deployed to Docker