title: dotnet aspnetcore docker build fails with a 145 error code
body: <p>I've used <a href="https://stormpath.com/blog/tutorial-deploy-asp-net-core-on-linux-with-docker" rel="noreferrer">this tutorial</a> to create my first docker webapi project.</p>
  
  <p>I'm using windows 7 (docker toolbox).</p>
  
  <p>This what I've ran:</p>
  
  <pre><code>dotnet new webapi
  </code></pre>
  
  <p>This is the Dockerfile:</p>
  
  <pre><code>FROM microsoft/dotnet:latest
  COPY . /app
  WORKDIR /app
  
  RUN ["dotnet", "restore"]
  RUN ["dotnet", "build"]
  
  EXPOSE 5000/tcp
  ENV ASPNETCORE_URLS http://*:5000
  
  ENTRYPOINT ["dotnet", "run"]
  </code></pre>
  
  <p>This is how I created the image:</p>
  
  <pre><code>docker build -t mydemos:aspnetcorehelloworld .
  </code></pre>
  
  <p>And this is how I've created and ran the container:</p>
  
  <pre><code>docker run -d -p 8080:5000 -t mydemos:aspnetcorehelloworld
  </code></pre>
  
  <p><strong>My service ran successfully as a docker container.</strong></p>
  
  <p>Then, I tried changing the Dockerfile to work on a aspnetcore base image:</p>
  
  <p><code>FROM microsoft/dotnet:latest</code> was changed to <code>FROM microsoft/aspnetcore:1.0.1</code></p>
  
  <p>The new Dockerfile looks like:</p>
  
  <pre><code>FROM microsoft/aspnetcore:1.0.1
  COPY . /app
  WORKDIR /app
  
  RUN ["dotnet", "restore"]
  RUN ["dotnet", "build"]
  
  EXPOSE 5000/tcp
  ENV ASPNETCORE_URLS http://*:5000
  
  ENTRYPOINT ["dotnet", "run"]
  </code></pre>
  
  <p>Now, I've tried to build the new image using</p>
  
  <pre><code>docker build -t mydemos:aspnetcorehelloworld1 .
  </code></pre>
  
  <p>And I get an error.<br/> This is the build log:</p>
  
  <pre><code>Sending build context to Docker daemon 636.9 kB
  Step 1/8 : FROM microsoft/aspnetcore:1.0.1
   ---&gt; 2c7bbc508bb2
  Step 2/8 : COPY . /app
   ---&gt; Using cache
   ---&gt; 1d5b9bd908b3
  Step 3/8 : WORKDIR /app
   ---&gt; Using cache
   ---&gt; c1d5d091d111
  Step 4/8 : RUN dotnet restore
   ---&gt; Running in 8399e21caeb2
  Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
    http://go.microsoft.com/fwlink/?LinkID=798306&amp;clcid=0x409
  The command 'dotnet restore' returned a non-zero code: 145
  </code></pre>
  
  <p>I went into the url, reinstalled stuff and I still get an error.<br/>
  I've tried to use the dotnet cli commands in the same command line session and I succeed (<code>dotnet restore</code> works).</p>
  
  <p>I've tried to search this error around, but couldn't really find any solution.</p>
  
  <p>What am I missing here? I'm getting this 145 error on multiple occasions and tests.</p>