Guillaume Lours 2fee7d3e73 Bump vulnerable and EOL stacks, fix broken samples (#852) 16 ore fa
..
app 2fee7d3e73 Bump vulnerable and EOL stacks, fix broken samples (#852) 16 ore fa
README.md 2fee7d3e73 Bump vulnerable and EOL stacks, fix broken samples (#852) 16 ore fa
compose.yaml 2fee7d3e73 Bump vulnerable and EOL stacks, fix broken samples (#852) 16 ore fa
output.jpg f1e4cca535 Move all samples to the root dir 6 anni fa

README.md

Compose sample application: ASP.NET with MS SQL server database

Project structure:

.
├── app
│   ├── aspnetapp
│   │   ├── appsettings.Development.json
|   |   └── ...
│   ├── ...
│   └── Dockerfile
└── compose.yaml

compose.yaml

services:
  web:
    build: app
    ports:
    - 80:8080
  db:
    image: mcr.microsoft.com/mssql/server:2022-latest
    platform: linux/amd64
    ...

The compose file defines an application with two services web and db. The image for the web service is built with the Dockerfile inside the app directory (build parameter).

When deploying the application, docker compose maps the container port 8080 to port 80 of the host as specified in the file. Make sure port 80 on the host is not being used by another container, otherwise the port should be changed.

ℹ️ INFO
MS SQL Server images are only published for AMD64. On Apple silicon, Docker Desktop runs them through Rosetta emulation (Azure SQL Edge, previously used here for ARM64, was retired by Microsoft in September 2025).

Deploy with docker compose

$ docker compose up -d
Creating network "aspnet-mssql_default" with the default driver
Building web
Step 1/13 : FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
2.1: Pulling from dotnet/core/sdk
....
....
a9dca2f6722a: Pull complete
Digest: sha256:9b700672670bb3db4b212e8aef841ca79eb2fce7d5975a5ce35b7129a9b90ec0
Status: Downloaded newer image for microsoft/mssql-server-linux:latest
Creating aspnet-mssql_web_1 ... done
Creating aspnet-mssql_db_1  ... done

Expected result

Listing containers must show two containers running and the port mapping as below:

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES
7f3a2a7ea5c0        microsoft/mssql-server-linux   "/opt/mssql/bin/sqls…"   4 minutes ago       Up 4 minutes        1433/tcp             aspnet-mssql_db_1
27342dde8b64        aspnet-mssql_web               "dotnet aspnetapp.dll"   4 minutes ago       Up 4 minutes        0.0.0.0:80->80/tcp   aspnet-mssql_web_1

After the application starts, navigate to http://localhost:80 in your web browser.

page

Stop and remove the containers

$ docker compose down