.NET Related containers
Install ms sql on container
docker run -e "ACCEPT_EULA=Y" \
-e "MSSQL_SA_PASSWORD=Redhat@123456" \
-p 1433:1433 \
--name sql2022 \
-d mcr.microsoft.com/mssql/server:2022-latestCreate a database in Ms sql
docker run -it --rm \
--network container:sql2022 \
mcr.microsoft.com/mssql-tools \
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'Redhat@123456' -Q "CREATE DATABASE LMSDatabase"Check the database if available
docker run -it --rm --network container:sql2022 mcr.microsoft.com/mssql-tools /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'Redhat@123456'
1> SELECT name FROM sys.databases;
2> GO
name
--------------------------------------------------------------------------------------------------------------------------------
master
tempdb
model
msdb
LMSDatabase
(5 rows affected){
"ConnectionStrings": {
"DefaultConnection": "Server=localhost,1433;Database=LMSDatabase;User Id=sa;Password=Redhat@123456;TrustServerCertificate=true"
}
}๐ Host a Static Website with IIS in Docker (Windows)
This guide walks you through creating and deploying a simple static HTML site using IIS inside a Docker container on Windows.
๐ Project Structure
iis-static-site/
โโโ Dockerfile
โโโ html/
โโโ index.html๐ Step 1: Create index.html
html/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Welcome to IIS Container</title>
</head>
<body>
<h1>Hello from Docker + IIS!</h1>
<p>This static page is served from an IIS container.</p>
</body>
</html>๐ณ Step 2: Create Dockerfile
Dockerfile
# Use the official IIS image
FROM mcr.microsoft.com/windows/servercore/iis
# Copy static site contents to IIS web root
COPY ./html/ /inetpub/wwwroot/๐๏ธ Step 3: Build Docker Image
Open PowerShell or Command Prompt in the project root and run:
docker build -t iis-static-site .โถ๏ธ Step 4: Run the Container
docker run -d -p 8080:80 --name iis-container iis-static-site๐ Step 5: Access the Website
Visit the following URL in your browser:
http://localhost:8080You should see:
โ Hello from Docker + IIS!
๐งน Step 6: Stop & Remove Container (Optional)
docker stop iis-container
docker rm iis-containerhttps://learn.microsoft.com/en-us/dotnet/core/docker/build-container?tabs=linux&pivots=dotnet-8-0 Some Example: https://github.com/nitin27may/clean-architecture-docker-dotnet-angular https://github.com/trevoirwilliams/ConferenceAttendees.CloudNativeDevelopment.git https://learn.microsoft.com/en-us/visualstudio/containers/tutorial-multicontainer?view=vs-2022
https://github.com/docker/awesome-compose/tree/master/aspnet-mssql