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