title: What is --from used in copy command in dockerfile
body: <p>I am seeing a dockerfile whose code is given below:</p>
  <pre><code>FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
  WORKDIR /app
  EXPOSE 80
  EXPOSE 443
  
  FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
  WORKDIR /src
  COPY [&quot;FirstDockerApp/FirstDockerApp.csproj&quot;, &quot;FirstDockerApp/&quot;]
  RUN dotnet restore &quot;FirstDockerApp/FirstDockerApp.csproj&quot;
  COPY . .
  WORKDIR &quot;/src/FirstDockerApp&quot;
  RUN dotnet build &quot;FirstDockerApp.csproj&quot; -c Release -o /app/build
  
  FROM build AS publish
  RUN dotnet publish &quot;FirstDockerApp.csproj&quot; -c Release -o /app/publish
  
  FROM base AS final
  WORKDIR /app
  COPY --from=publish /app/publish .
  ENTRYPOINT [&quot;dotnet&quot;, &quot;FirstDockerApp.dll&quot;]
  </code></pre>
  <p>On the 2nd last line there is <code>COPY --from=publish /app/publish .</code>. I don't understand why --from is used and what purpose it solves. Can you please help me to understand it?</p>