ASP.Net Core Web API with Docker Compose, PostgreSQL and EF Core.

Rajesh Vijay
Frontend Weekly
Published in
5 min readOct 7, 2018

--

In this article we’ll learn how to build a .Net Core Web API with PostgreSQL database both run in Docker containers. Since we have multiple containers, for ease of maintenance, we will add Docker Compose to the development workflow.

Prerequisites

  • Docker Installed
  • .NET Core Installed
  • VS Code Installed

Source Code

You can view the source code at GitHub.

From a terminal, run the following commands

dotnet new webapi -o dockerapi
cd dockerapi
code .
dotnet run

We can now verify if the app is correctly running by entering the URL http://localhost:5001/api/values on any web browser. You should see the output below.

Containerizing the app

Let’s add Docker support to this application.

--

--