title: Docker build failed to compute cache key
body: <p>I have the below project structure</p>
  <pre><code>Mode                 LastWriteTime         Length Name
  ----                 -------------         ------ ----
  d-----         4/22/2021   1:49 PM                App_Start
  d-----         3/20/2020   3:35 PM                Areas
  d-----          5/4/2021   7:01 PM                bin
  d-----         3/20/2020   3:35 PM                Content
  d-----          5/4/2021   5:59 PM                Controllers
  d-----         3/20/2020   3:35 PM                fonts
  d-----         8/20/2020   9:43 PM                obj
  d-----          7/9/2020   8:43 PM                Properties
  d-----         3/20/2020   3:35 PM                Scripts
  d-----         3/20/2020   3:35 PM                Views
  -a----          5/4/2021   6:00 PM             46 .dockerignore
  -a----          5/4/2021   6:00 PM          45239 foo.csproj
  -a----          5/4/2021  11:21 PM           1621 foo.csproj.user
  -a----         4/22/2021   1:49 PM            390 ConnectionStrings.config
  -a----          5/5/2021  12:17 AM            375 Dockerfile
  -a----         3/20/2020   3:35 PM            116 Global.asax
  -a----         3/20/2020   3:35 PM            717 Global.asax.cs
  -a----         8/13/2020   1:05 PM           1770 NLog.config
  -a----         3/20/2020   3:35 PM         159853 NLog.xsd
  -a----          5/4/2021   6:00 PM           9217 packages.config
  -a----         3/20/2020   3:35 PM          12294 UnityConfiguration30.xsd
  -a----          5/4/2021   6:00 PM          29650 Web.config
  -a----         3/20/2020   3:35 PM           1308 Web.Debug.config
  -a----         3/20/2020   3:35 PM            705 Web.Release.config
  </code></pre>
  <p>And I have one directory in <code>bin directory</code> that name is <code>app.publish</code>.</p>
  <p>And my Dockerfile is like below:</p>
  <pre><code>#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
  #For more information, please see https://aka.ms/containercompat
  
  FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019
  ARG source
  WORKDIR /inetpub/wwwroot
  COPY bin/app.publish .
  </code></pre>
  <p>After I run below command to build image from this docker file</p>
  <pre><code>docker build -t soroshsabz/testcoreservice .
  </code></pre>
  <p>I got the below error</p>
  <pre><code>[+] Building 15.1s (7/7) FINISHED
   =&gt; [internal] load build definition from Dockerfile                                                               0.1s
   =&gt; =&gt; transferring dockerfile: 414B                                                                               0.0s
   =&gt; [internal] load .dockerignore                                                                                  0.1s
   =&gt; =&gt; transferring context: 34B                                                                                   0.0s
   =&gt; [internal] load metadata for mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019         14.9s
   =&gt; [1/3] FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019@sha256:e1475e80eb3cbdfd81  0.1s
   =&gt; =&gt; resolve mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019@sha256:e1475e80eb3cbdfd81  0.1s
   =&gt; [internal] load build context                                                                                  0.1s
   =&gt; =&gt; transferring context: 2B                                                                                    0.0s
   =&gt; CACHED [2/3] WORKDIR /inetpub/wwwroot                                                                          0.0s
   =&gt; ERROR [3/3] COPY bin/app.publish .                                                                             0.0s
  ------
   &gt; [3/3] COPY bin/app.publish .:
  ------
  failed to compute cache key: &quot;/bin/app.publish&quot; not found: not found
  </code></pre>
  <p><strong>My question is why I got this error? and how to resolve it?</strong></p>
  <p>I use <code>Docker Engine Community 20.10.6</code> on <code>Windows 10 20H2 19042.964</code></p>
  <p>I see <em><a href="https://stackoverflow.com/q/66146088/1539100">Docker - failed to compute cache key: not found - runs fine in Visual Studio</a></em> and <a href="https://stackoverflow.com/a/63257667/1539100">some internal links</a>, but does not find any useful things.</p>
  <p>I am binging my problem and find some same problem like <em><a href="https://dockerquestions.com/2020/10/16/dockerfile-cant-copy-specified-local-directory-file/" rel="nofollow noreferrer">Dockerfile can’t copy specified local directory &amp; file</a></em> or <em><a href="https://windowsquestions.com/2020/12/17/windows-docker-dockerfile-copy-file-inside-folder/" rel="nofollow noreferrer">Windows Docker Dockerfile COPY file inside folder</a></em>.</p>