Docker is not restarting when code changes - spring

As described here https://docs.docker.com/compose/gettingstarted/#step-7-update-the-application if I mount the folder with the source code inside the volumes of that docker, I should see my changes instantly...
However, this is my docker-compose:
version: '3'
services:
database:
...
engine:
build: ./name
restart: always
volumes:
- .:/name-code
- ./name/config-examples:/config
ports:
- 8080:8080
depends_on:
- database
environment:
- TZ=Europe/Rome
...
grafana:
...
and as you can see I'm mounting .:/name-code... so as soon as I change code inside this directory, I should see that docker restarting with the new JAR (I'm developing a Spring boot application)... however this is not happening, infact my local jar looks like this:
-rw-r--r-- 1 user staff 43171359 Jun 1 12:35 project.jar
but the jar in the docker is the following:
-rw-r--r-- 1 root root 43171269 May 31 19:52 app.jar
(Is just been renamed), but as you can see the last update is very different, and infact the updates are not been imported
Log:
docker-compose --verbose build
compose.config.config.find: Using configuration files: ./docker-compose.yml
compose.cli.docker_client.get_client: docker-compose version 1.29.1, build c34c88b2
docker-py version: 5.0.0
CPython version: 3.9.0
OpenSSL version: OpenSSL 1.1.1h 22 Sep 2020
compose.cli.docker_client.get_client: Docker base_url: http+docker://localhost
compose.cli.docker_client.get_client: Docker version: Platform={'Name': 'Docker Engine - Community'}, Components=[{'Name': 'Engine', 'Version': '20.10.6', 'Details': {'ApiVersion': '1.41', 'Arch': 'amd64', 'BuildTime': '2021-04-09T22:44:56.000000000+00:00', 'Experimental': 'false', 'GitCommit': '8728dd2', 'GoVersion': 'go1.13.15', 'KernelVersion': '5.10.25-linuxkit', 'MinAPIVersion': '1.12', 'Os': 'linux'}}, {'Name': 'containerd', 'Version': '1.4.4', 'Details': {'GitCommit': '05f951a3781f4f2c1911b05e61c160e9c30eaa8e'}}, {'Name': 'runc', 'Version': '1.0.0-rc93', 'Details': {'GitCommit': '12644e614e25b05da6fd08a38ffa0cfe1903fdec'}}, {'Name': 'docker-init', 'Version': '0.19.0', 'Details': {'GitCommit': 'de40ad0'}}], Version=20.10.6, ApiVersion=1.41, MinAPIVersion=1.12, GitCommit=8728dd2, GoVersion=go1.13.15, Os=linux, Arch=amd64, KernelVersion=5.10.25-linuxkit, BuildTime=2021-04-09T22:44:56.000000000+00:00
compose.cli.verbose_proxy.proxy_callable: docker inspect_network <- ('codice_default')
compose.cli.verbose_proxy.proxy_callable: docker inspect_network -> {'Attachable': False,
'ConfigFrom': {'Network': ''},
'ConfigOnly': False,
'Containers': {},
'Created': '2021-06-01T10:31:25.2768986Z',
'Driver': 'bridge',
'EnableIPv6': False,
'IPAM': {'Config': [{'Gateway': '172.31.0.1', 'Subnet': '172.31.0.0/16'}],
'Driver': 'default',
'Options': None},
...
compose.project.build: database uses an image, skipping
compose.project.build: grafana uses an image, skipping
compose.service.build: Building engine
[+] Building 0.3s (8/8) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 37B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/adoptopenjdk/openjdk11:jdk-11.0.11_9-alpine-slim 0.0s
=> [1/3] FROM docker.io/adoptopenjdk/openjdk11:jdk-11.0.11_9-alpine-slim 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 1.43kB 0.0s
=> CACHED [2/3] COPY target/*.jar app.jar 0.0s
=> [3/3] COPY config-examples /app/config 0.0s
=> exporting to image 0.1s
=> => exporting layers 0.0s
=> => writing image sha256:7162be9dfe5c15feedd12d19a5985a0f619e623eb69e949283c6e2d66442f533 0.0s
=> => naming to docker.io/library/codice_engine 0.0s
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
the Dockerfile of the engine service is the following:
FROM adoptopenjdk/openjdk11:jdk-11.0.11_9-alpine-slim
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
COPY config-examples /app/config
CMD ["java","-jar","/app.jar"]

I read again you post, and the misunderstanding is on the fact that .:/name-code is a volume mount point, it is not part of the docker image built by docker-compose, so changing its content does not force docker to rebuild the image. Else, the new content will be accessibile from the container.
For that reason you can see that CACHED [2/3] COPY target/*.jar app.jar is retrieved from a cached layer.
In my opinion the solution is to write a custom Dockerfile which adds explicitly the jar as depicted here https://docs.docker.com/compose/compose-file/compose-file-v3/#dockerfile . So, each time the jar changes, the image will be rebuilt as you expect.
Regards.

Related

Oracle from Docker - stuck on log file is : /home/oracle/setup/log/untarDB.log

I am trying to start Oracle 12.x in docker container, but start sequence always stuck on log file is : /home/oracle/setup/log/untarDB.log and container is not properly started.
I have tried the same steps with versions 12.1.0.2 and 12.2.0.1.
What I have done:
docker login container-registry.oracle.com/database/enterprise:12.2.0.1
Prilogovani k Oraclu s Oracle credentials
docker login container-registry.oracle.com/database/enterprise:12.2.0.1
docker pull container-registry.oracle.com/database/enterprise:12.2.0.1
docker run -d --name DockerOra122 -p 1521:1521 -p 5500:5500 -e ORACLE_CHARACTERSET=AL32UTF8 -e ORACLE_SID=GENAL32UTF8 -e ORACLE_PDB=GENAL32UTF8PDB -e ORACLE_PWD=password123 container-registry.oracle.com/database/enterprise:12.2.0.1
Docker container log shows:
2023-01-09 06:50:56 Setup Oracle Database
2023-01-09 06:50:56 Oracle Database 12.2.0.1 Setup
2023-01-09 06:50:56 Mon Jan 9 05:50:56 UTC 2023
2023-01-09 06:50:56
2023-01-09 06:50:56 Check parameters ......
2023-01-09 06:50:56 log file is : /home/oracle/setup/log/paramChk.log
2023-01-09 06:50:56 paramChk.sh is done at 0 sec
2023-01-09 06:50:56
2023-01-09 06:50:56 untar DB bits ......
2023-01-09 06:50:56 log file is : /home/oracle/setup/log/untarDB.log
And the installation is stuck.
If the same steps are performed with database 19.3.0.0 it works fine and docker conatainer is started and Oracle Database is created within this container.
( docker pull container-registry.oracle.com/database/enterprise:19.3.0.0)
Please advise, what needs to be changed for 12.x versions to properly start Oracle Container.
You need to create your own local image. You cannot use DockerHub oracle image, because those images are not valid ( not maintained by Oracle ).
Refer to issues in GitHub. For example: https://github.com/oracle/docker-images/issues/1165
Please find steps I performed for 19.3. Those steps are derived from doc https://github.com/oracle/docker-images/blob/main/OracleDatabase/SingleInstance/README.md
Download ZIP file https://www.oracle.com/database/technologies/oracle-database-software-downloads.html - LINUX.X64_193000_db_home.zip
Git Clone - https://github.com/oracle/docker-images.git
Copy LINUX.X64_193000_db_home.zip to cloned directory ( e.g. to c:\tmp\OracledDocker\docker-images\OracleDatabase\SingleInstance\dockerfiles\19.3.0\LINUX.X64_193000_db_home.zip )
a. Run file https://github.com/oracle/docker-images/blob/main/OracleDatabase/SingleInstance/dockerfiles/buildContainerImage.sh (if you are on Windows, use cygwin or WSL2 Ubutnu)
b. WSL Ubuntu
cd /mnt/c/tmp/OracledDocker/docker-images/OracleDatabase/SingleInstance/dockerfiles
./buildContainerImage.sh -v 19.3.0 -t oracle_ee_19.3.0 -e
Command line log :
/mnt/c/tmp/OracledDocker/docker-images/OracleDatabase/SingleInstance/dockerfiles# ./buildContainerImage.sh -v 19.3.0 -t oracle_ee_19.3.0 -e
WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
Checking Docker version.
Checking if required packages are present and valid...
LINUX.X64_193000_db_home.zip: OK
==========================
Container runtime info:
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc., v0.9.1)
compose: Docker Compose (Docker Inc., v2.13.0)
dev: Docker Dev Environments (Docker Inc., v0.0.5)
extension: Manages Docker extensions (Docker Inc., v0.2.16)
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
scan: Docker Scan (Docker Inc., v0.22.0)
Server:
Containers: 2
Running: 2
Paused: 0
Stopped: 0
Images: 19
Server Version: 20.10.21
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 770bd0108c32f3fb5c73ae1264f7e503fe7b2661
runc version: v1.1.4-0-g5fd4c4d
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 5.4.72-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 24.95GiB
Name: docker-desktop
ID: Q43V:IGLX:SYFM:VX4M:LR2W:AK4S:K4QJ:AIIH:AA7H:Q2GR:OBG7:6KEL
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5000
127.0.0.0/8
Live Restore Enabled: false
WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
==========================
Building image 'oracle_ee_19.3.0' ...
[+] Building 1000.0s (16/16) FINISHED
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 5.09kB 0.0s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/oraclelinux:7-slim 4.7s
=> [auth] library/oraclelinux:pull token for registry-1.docker.io 0.0s
=> [internal] load build context 79.6s
=> => transferring context: 3.06GB 79.6s
=> [base 1/4] FROM docker.io/library/oraclelinux:7-slim#sha256:884134b6d781eaa806df4dd4a4d83db0019e791bed8095e6dfdf81c3d6235d7f 9.1s
=> => resolve docker.io/library/oraclelinux:7-slim#sha256:884134b6d781eaa806df4dd4a4d83db0019e791bed8095e6dfdf81c3d6235d7f 0.0s
=> => sha256:5047ab65cfa6bf7a7d280e0ab7e83e94ad04bd301eb7503a6cb5a80006112959 529B / 529B 0.0s
=> => sha256:19d1d44a7ad155521760e3cc2b8ae06a32e81c2ac28a9ff529bd4760829e51d8 1.48kB / 1.48kB 0.0s
=> => sha256:d26998a7c52d2b84e7927f97651d1d703a805c8e4d3f658a03138721f5a5dd44 49.82MB / 49.82MB 4.7s
=> => sha256:884134b6d781eaa806df4dd4a4d83db0019e791bed8095e6dfdf81c3d6235d7f 547B / 547B 0.0s
=> => extracting sha256:d26998a7c52d2b84e7927f97651d1d703a805c8e4d3f658a03138721f5a5dd44 3.6s
=> [base 2/4] COPY setupLinuxEnv.sh checkSpace.sh /opt/install/ 0.9s
=> [base 3/4] COPY runOracle.sh startDB.sh createDB.sh createObserver.sh dbca.rsp.tmpl setPassword.sh checkDBStatus.sh runUserScripts.sh relinkOracleBinary.sh configTcps.sh 0.1s
=> [base 4/4] RUN chmod ug+x /opt/install/*.sh && sync && /opt/install/checkSpace.sh && /opt/install/setupLinuxEnv.sh && rm -rf /opt/install 245.4s
=> [builder 1/2] COPY --chown=oracle:dba LINUX.X64_193000_db_home.zip db_inst.rsp installDBBinaries.sh /opt/install/ 23.7s
=> [builder 2/2] RUN chmod ug+x /opt/install/*.sh && sync && /opt/install/installDBBinaries.sh ee 430.3s
=> [stage-2 1/4] COPY --chown=oracle:dba --from=builder /opt/oracle /opt/oracle 147.0s
=> [stage-2 2/4] RUN /opt/oracle/oraInventory/orainstRoot.sh && /opt/oracle/product/19c/dbhome_1/root.sh 1.9s
=> [stage-2 3/4] WORKDIR /home/oracle 0.5s
=> [stage-2 4/4] RUN echo 'ORACLE_SID=${ORACLE_SID:-ORCLCDB}; export ORACLE_SID=${ORACLE_SID^^}' > .bashrc 0.9s
=> exporting to image 38.5s
=> => exporting layers 38.5s
=> => writing image sha256:4d049ba2dbcf6fee56282363c2ec5b78afe6adf0cb3ab9d5a2d6554070f2a63a 0.0s
=> => naming to docker.io/library/oracle_ee_19.3.0 0.0s
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
Oracle Database container image for 'ee' version 19.3.0 is ready to be extended:
--> oracle_ee_19.3.0
Build completed in 1001 seconds.
Now you should be able to find Docker image in your docker. For example docker images
C:\>docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
oracle_ee_19.3.0 latest 4d049ba2dbcf 11 minutes ago 6.67GB
Now you can start your Oracle Cotainer:
docker run -d --name DockerOra193 -p 1521:1521 -p 5500:5500 -e ORACLE_CHARACTERSET=AL32UTF8 -e ORACLE_SID=GENAL32UTF8 -e ORACLE_PDB=GENAL32UTF8PDB -e ORACLE_PWD=password123 oracle_ee_19.3.0

build Dockerfile inside docker-compose.yml which is in another path

i have springboot application, which is created via initializr and i created Dockerfile like following
FROM adoptopenjdk/openjdk11:alpine-jre
ARG JAR_FILE=target/tender-api.jar
WORKDIR /opt/app
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","app.jar"]
i want to deploy in my ubuntu server. Because it i created in another path docker-compose.yml
version: '3.8'
services:
appDB:
image: postgres:14.1-alpine
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- '5432:5432'
volumes:
- db:/var/lib/postgresql/data
tender:
image: tender-api:1
build:
context: .
dockerfile: /root/dev/tender-api/Dockerfile
volumes:
- /data/tender-api
ports:
- "8080:8080"
depends_on:
- appDB
volumes:
db:
driver: local
And verbose logs are like following
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 32B done
#1 DONE 0.0s
#2 [internal] load .dockerignore
#2 transferring context: 2B done
#2 DONE 0.0s
#3 [internal] load metadata for docker.io/adoptopenjdk/openjdk11:alpine-jre
#3 DONE 0.9s
#4 [internal] load build context
#4 transferring context: 2B done
#4 DONE 0.0s
#5 [3/4] RUN echo target/tender-api.jar
#5 CACHED
#6 [2/4] WORKDIR /opt/app
#6 CACHED
#7 [4/4] COPY target/tender-api.jar app.jar
#7 ERROR: failed to walk /var/lib/docker/tmp/buildkit-mount4259571673/target: lstat /var/lib/docker/tmp/buildkit-mount4259571673/target: no such file or directory
#8 [1/4] FROM docker.io/adoptopenjdk/openjdk11:alpine-jre#sha256:c4e70e7696899eae647575724b77cc71efa8bea35c17b8d58fbb9bb6485af353
#8 resolve docker.io/adoptopenjdk/openjdk11:alpine-jre#sha256:c4e70e7696899eae647575724b77cc71efa8bea35c17b8d58fbb9bb6485af353 done
#8 sha256:c4e70e7696899eae647575724b77cc71efa8bea35c17b8d58fbb9bb6485af353 433B / 433B done
#8 sha256:b565a288907ff71371d4b22e2d1756ecdab0f5df188a8da6e5af388c330b4615 951B / 951B done
#8 sha256:00e2ce5eeb8afe4d1487c5976172e0fcb4258cbf7628836e6476be083e9e3f3e 6.13kB / 6.13kB done
#8 CANCELED
------
> [4/4] COPY target/tender-api.jar app.jar:
------
failed to solve: failed to compute cache key: failed to walk /var/lib/docker/tmp/buildkit-mount4259571673/target: lstat /var/lib/docker/tmp/buildkit-mount4259571673/target: no such file or directory
now, i can't understand what it is "ERROR: failed to walk ...", i just executed
docker compose up and afterwards I thought that docker can't create file, because of that i have tried with sudo , Nevertheless it's not working
i resolved it and wanted to share with you my solution
changed Dockerfile like following
#
# Build stage
#
FROM maven:3.6.0-jdk-11-slim AS build
COPY src /app/src
COPY pom.xml /app
RUN mvn -q -f /app/pom.xml clean package -DskipTests
# without -q you can take limit size problem
#
# Package stage
#
FROM adoptopenjdk/openjdk11:alpine-jre
ARG JAR_FILE=/app/target/tender-api.jar
COPY --from=build ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
as second, changed context and dockerfile in docker-compose.yml
context: /root/dev/tender-api/
dockerfile: Dockerfile

docker-compose up gives 'failed to read dockerfile: error from sender'

Tried to simply dockerize my mongodb and spring boot application. Had a lot of struggles and thought I almost had it running and than the terminal hits me with this error:
Building user
[+] Building 0.0s (1/2)
=> ERROR [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 121B 0.0s
------
> [internal] load build definition from Dockerfile:
------
failed to solve with frontend dockerfile.v0: failed to read dockerfile: error from sender: walk \\?\C:\Users\ZRC\Documents\GitHub\s6-kwetter-backend\user\Dockerfile: The system cannot
find the path specified.
ERROR: Service 'user' failed to build : Build failed
Dockerfile (which is in a sub-directory; user-module):
FROM openjdk:11
EXPOSE 8081
ADD target/user-module-docker.jar user-docker.jar
CMD ["java", "-jar", "user-docker.jar"]
docker-compose.yml (which is in the main directory that has multiple modules/microservices):
version: '3.8'
services:
user:
build: ./user/Dockerfile
restart: unless-stopped
container_name: user-ms
ports:
- 8081:8080
mongodb:
image: mongo
restart: always
container_name: mongodb
ports:
- 27017:27017
Like it says that the path specified cannot be found but it literally exists, so where could I have gone wrong?
The error is telling you that the Dockerfile was not found, because the path doesn't exist. That's because it is trying to enter the path as folder.
The system cannot find the path specified.
This comes because you made a mistake in the compose build syntax. There are 2 ways it can be used.
1. The simple form:
This is using ./users/ as context, expecting a Dockerfile to be in this directory.
user:
build: ./user
2. The complex form:
user:
build:
context: ./
dockerfile: ./users/Dockerfile
This lets you separate the context and where the Dockerfile is. In this example, the current folder is used as context, and the Dockerfile is taken from ./users/Dockerfile. It is also useful when you have a different name for your Dockerfile. I.E. Dockerfile.dev.
Note that this is just an example, I don't know if this would make sense in your project. You need to know what context is the correct one.
What do I mean by context?
The docker build command builds Docker images from a Dockerfile and a “context”. A build’s context is the set of files located in the specified PATH or URL. The build process can refer to any of the files in the context. For example, your build can use a COPY instruction to reference a file in the context.
As example:
docker build --file /path/to/Dockerfile /path/to/context

Command doesn't carry over docker image

I'm passing my first docker tutorial, and for some reason, when I create docker image last command don't pass there.
Dockerfile
FROM openjdk:11 as build
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app
CMD ["java", "Application.java"]
Log
nikolaev#C6151 forDocker % docker build -t my-hello-world .
[+] Building 2.8s (9/9) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 172B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/openjdk:11 2.6s
=> [1/4] FROM docker.io/library/openjdk:11#sha256:84539d4caf6f51c850978ee138458560f84c12e647ad78b8fd9f24854b27da1d 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 647B 0.0s
=> CACHED [2/4] RUN mkdir -p /usr/src/app 0.0s
=> CACHED [3/4] WORKDIR /usr/src/app 0.0s
=> [4/4] COPY . /usr/src/app 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:985e3ae026805c21d7fadac22c9cda10f2e0041d67a706278858baa79dce09e6 0.0s
=> => naming to docker.io/library/my-hello-world
The CMD command is in the generated image. It is just not shown in the log because it doesn't create a layer. If you run your image you will see it executes the java Application.java

Docker build pull access denied, repository does not exist or may require

I am trying to generate a Docker Image without using Visual Studio. I am in the project folder and I execute from windows 10 admin command line docker build . I can't figure out how to make this work.
[+] Building 1.3s (8/9)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 753B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 34B 0.0s
=> [internal] load metadata for mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim 0.0s
=> [base 1/2] FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim 0.0s
=> ERROR FROM docker.io/publish/app:latest 1.2s
=> => resolve docker.io/publish/app:latest 1.2s
=> CACHED [base 2/2] WORKDIR /app 0.0s
=> CACHED [final 1/2] WORKDIR /app 0.0s
=> [auth] publish/app:pull token for registry-1.docker.io 0.0s
------
> FROM docker.io/publish/app:latest:
------
failed to load cache key: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
This is my dockerfile:
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["src/App.Web/App.Web.csproj", "src/App.Web/"]
RUN dotnet restore "App.Web.csproj"
COPY . .
WORKDIR "/src/App.Web"
RUN dotnet build App.Web.csproj -c Debug -o /app
FROM build as debug
RUN dotnet publish "App.Web.csproj" -c Debug -o /app
FROM base as final
WORKDIR /app
COPY --from=publish/app /app .
ENTRYPOINT ["dotnet","App.Web.dll"]
You have stages called base, build, and debug. Then in the final stage you have:
COPY --from=publish/app /app .
When docker can't find the stage with that name, publish/app, it tries to find that image, which doesn't exist. I'm guessing you want to copy from the build stage, e.g.
COPY --from=build /app .
Are you logged in? Try with docker login and then execute docker build once again
As I can see here aspnet in docker hub the repository that you intent to use has been renamed. Use the following instead
from mcr.microsoft.com/dotnet/aspnet:3.1-buster-slim
Repositories have been renamed and a similar issue can be found here similar issue

Resources