dotnet core 2.2 app DockerFile COPY Fails /overlay2/

My dotnet core 2.2 app have this structure (which is pretty standard):

- .sln
- DockerFile
- MyApp/
  |- *.csproj

My DockerFile is this:

FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env
WORKDIR /app

# Copy csproj and restore as distinct layers
COPY ./MyApp/*.csproj ./
RUN dotnet restore

# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "MyApp.dll"]

I always get this error:

Step 9/10 : COPY --from=build-env /app/out .
ERROR: Service 'myapp' failed to build: COPY failed: stat /var/lib/docker/overlay2/ed30d6e8a88b5d65bb14a5e972428135a78701c860f510d4dcc3e5c4947916d3/merged/app/out: no such file or directory

I looked online and could only find suggestions about resetting the data of Docker, which I tried without any kind of success.

I’m building using the command docker build . from the DockerFile repository.

Is there something missing from my DockerFile? Do you have any clue to help me figure this out?

Source: StackOverflow