Step by step: ASP.NET Core on Docker

This week I have to give an introductory talk on DevOps and Docker and therefore I decided to prepare a simple Step by step: ASP.NET Core on Docker sample.

Assuming you have Docker installed and running, follow these 4 simple steps:

1. Create a dockerfile
2. Create a docker image
3. Test the Docker image
4. Run the Docker image as a daemon process

You can get a copy of the docker file here: https://github.com/cmendible/dotnetcore.samples/tree/master/docker.helloworld

Hope it helps!

5 thoughts on “Step by step: ASP.NET Core on Docker

  1. Hi Carlos,
    thanks so much for this tutorial! The building of the image looks pretty straight forward.
    But I get the following error, when I try to build the image. Did I miss something? I followed every step of this tutorial.

    I am running docker on Debian 9 with docker version “17.06.0-ce, build 02c1d87”.

    Step 8/9 : RUN dotnet restore
    —> Running in 850825db651b
    /repositories/aspnet-core-helloworld/src/dotnetstarter/dotnetstarter.xproj(7,3): error MSB4019: The imported project “/usr/share/dotnet/sdk/1.0.4/Microsoft/VisualStudio/v14.0/DNX/Microsoft.DNX.Props” was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
    The command ‘/bin/sh -c dotnet restore’ returned a non-zero code: 1

    1. Just checked the image documentation, and it was updated to support msbuild and not project.json. I’ll try to upgrade the code but in the meantime you can try with the tag 1.1.0-sdk-projectjson so your docker file should start like:

      FROM microsoft/dotnet:1.1.0-sdk-projectjson

Leave a Reply

Your email address will not be published. Required fields are marked *