Using ASP.NET Core 2 with Docker

Now that we've checked Docker is working and can run .NET Core, it's time for something a bit more complex. We're going to interactively log in to a container and create an ASP.NET Core 2 app inside.

Run the following command:

sudo docker run -it --rm microsoft/aspnetcore-build:2

Once the image is downloaded, you should get a slightly different command prompt. Let's be more ambitious and create a single page app using the React and Redux JavaScript libraries:

dotnet new reactredux -o AspNetCoreTwoDocker

Next we need to restore the JS packages from npm. Note that we haven't installed npm (or .NET Core); it has come included in the container image:

cd AspNetCoreTwoDockernpm install

Let's run the app in the background ...

Get ASP.NET Core 2 High Performance - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.