10 Minutes to Create & Run .NET Core Angular SPA in Docker

Adam Prescott
4 min readFeb 25, 2020

In this article, I’ll demonstrate how to create an ASP.NET Core Angular single-page application using the .NET Core CLI, create a Docker image, and run it as a container. The entire process is just 4 steps, each of which takes about a minute to perform — although creating the Docker image takes a couple minutes to complete. Note, also, that these same steps work from both Linux and Windows.

  1. Create Angular application
  2. Create Dockerfile
  3. Create Docker image
  4. Run container

Before you start, make sure you have the following prerequisites installed.

  • .NET Core SDK
  • Visual Studio Code with Docker extension
  • Docker

Installation can be verified by running these commands:

dotnet --version
code --version
code --install-extension ms-azuretools.vscode-docker
docker --version

Create the Application

We begin by creating our Angular application using the dotnet new command and specifying the angular template. The -o argument will cause the new project to be created in a sub-folder named my-app. This will create a .NET Core ASP.NET project with an Angular app in its ClientApp folder. After running the command, go into the new directory and launch Visual Studio Code.

dotnet new angular -o my-app
cd my-app
code .

--

--

Adam Prescott
Adam Prescott

Written by Adam Prescott

software engineer & manager of people

No responses yet