Skip to content
Dawid Brzozowski edited this page Mar 23, 2023 · 15 revisions

Overview

This section describes how to run our Api connected to MSSql database in docker containers.


Prerequisites


Before you start

  • Docker Desktop app is running.
  • Our server certificate is added.
  • Check if there are no running containers in Docker Desktop App (Containers Tab).
  • Make sure your connection string in src\modules\example\api\ExampleModule.cs file is set to "DockerDb".

services.AddDbContext<ExampleDbContext>(options => options.UseSqlServer(configurationManager.GetConnectionString("DockerDb")));

  • Navigate to the root of the solution (in PowerShell terminal)

Running Containers

Just type in the root of the solution (in PowerShell terminal).

docker compose up running our services (App and MsSql).

docker compose up -d running our services in background

docker compose up --build rebuild our image and run services

docker compose down stopping our services and release the resources.

or just pick docker compose project as start up project in visual studio

docker-startup-project


Database

MSSQL

Connect to database using SQL Server Management Studio with following credentials:

server name: localhost,1433

authentication: SQL Server Authentication

login: sa

password: S3cur3P@ssW0rd!

connection_to_database


Api

When your containers are running you can test our api in a browser at

https://localhost:8081/swagger - Actual dev

https://localhost:5081/swagger.- after adding local keycloak environment to dev


I'll add more info later.

Clone this wiki locally