ASP.NET Core Web API Demo with Docker, Nancy and Kestrel.
First head into the DotNetCore.WebApi.Docker.Demo
folder and then build a release version with the following commands.
cd DotNetCore.WebApi.Docker.Demo
dotnet build --configuration Release
After that, head back in the root of the project, then start running with docker (your terminal must be in same directory that the DockerFile):
cd ..
docker build -t dotnetapidemo . --no-cache
docker run -t -p 1234:5000 dotnetapidemo
First line builds app and sets image name to dotnetapidemo (you can change). The next line run app in a container exposing your port 5000 in port 1234 (you can change too).
To check if app is running, access http://localhost:1234/test
. You should see something like:
{"message":"This is a simple test"}