.NET Docker Tutorial - SQL Server Docker [.NET Docker]

preview_player
Показать описание

This is .Net Core Docker Tutorial [.Net Docker Tutorial] that explains how to containerize .Net application with SQL Server Database. Visual Studio provides the options to easily develop applications with Docker Support, Debug with Docker [Docker .Net Core Debug], and Deploy the Docker Container [Deploy .Net Core to Docker].

We are using the Official container image for Microsoft SQL Server on Linux for Docker Engine [SQL Server Docker]. We'll use this docker image for creating a container for SQL Server Database. Then the .Net Core application container can connect to the database container for read-write operations.

In this .NET Docker tutorial, you'll learn how to manage more than one container and communicate between them when using Container Tools in Visual Studio. Managing multiple containers requires container orchestration and requires an orchestrator such as Docker Compose, Kubernetes, or Service Fabric. Here, we'll use Docker Compose. Docker Compose is great for local debugging and testing in the course of the development cycle. This is a very important video as it covers a major part of Docker .Net Core Microservices.

Visual Studio provides a consistent way to develop Docker containers and validate your application locally. You can run and debug your apps in Linux or Windows containers running on your local Windows desktop with Docker installed, and you don't have to restart the container each time you make a code change.

You can view what's going on inside the containers that host your app by using the Containers window. If you're used to using the command prompt to run Docker commands to view and diagnose what's going on with your containers, this window provides a more convenient way to monitor your containers without leaving the Visual Studio IDE.

What is Docker Compose?
Docker Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.

Docker .Net Core:
.NET Core can easily run in a Docker container. Containers provide a lightweight way to isolate your application from the rest of the host system, sharing just the kernel, and using resources given to your application. Learn how to use docker for .Net Core and deploy .Net Core to Docker.

.NET Core images
Official .NET Core Docker images are published to the Microsoft Container Registry (MCR) and are discoverable at the Microsoft .NET Core Docker Hub repository. Each repository contains images for different combinations of the .NET (SDK or Runtime) and OS that you can use.
Microsoft provides images that are tailored for specific scenarios. For example, the ASP.NET Core repository provides images that are built for running ASP.NET Core apps in production.

The tools included in Visual Studio for developing with Docker containers [.Net Core Docker Container] are easy to use, and greatly simplify building, debugging, and deployment for containerized applications. You can work with a container for a single project, or use container orchestration with Docker Compose or Service Fabric to work with multiple services in containers.

Docker support in Visual Studio:
Docker support is available for ASP.NET projects, ASP.NET Core projects, and .NET Core and .NET Framework console projects.

The support for Docker in Visual Studio has changed over a number of releases in response to customer needs. There are two levels of Docker support you can add to a project, and the supported options vary by the type of project and the version of Visual Studio. With some supported project types, if you just want a container for a single project, without using orchestration, you can do that by adding Docker support. The next level is container orchestration support, which adds appropriate support files for the particular orchestrator you choose.

Docker support for a .Net Project [Blazor Docker]:
You can enable Docker support during project creation by selecting Enable Docker Support when creating a new project. You can add Docker support to an existing project by selecting Add - Docker Support in Solution Explorer. The Add - Docker Support and Add - Container Orchestrator Support commands are located on the right-click menu (or context menu) of the project node for an ASP.NET Core project in Solution Explorer.

Video Chapters:
0:00 - Video Summary
1:12 - Project Setup
4:23 - Adding Container Orchestration Support
5:24 - Working with Docker Compose
10:11 - Docker Networking Basics
14:38 - Publish to Docker Hub Repository
15:44 - Docker Compose Installation
17:33 - Deploying the Application

#CodingDroplets #Docker #Microservices
Рекомендации по теме
Комментарии
Автор

Nice video, It aswered the question I had on creating docker network. Thanks

refre
Автор

I have spent a lot of time researching how to do this and you have done it and explained it in an incredible way. Thank you for this.

faviorequena
Автор

wow it feels nice when you follow tutorial and all works in the end (except part where I searched how to use sql server 2022 instead of 2019)

kittkillward
Автор

People like you I encourage me to teach others because It's not always as easy as making a docker file and image and use the correct DB connection string .

muhammadzaakirmungrue
Автор

Amazing tutorial with very valuable lessons in it. For me it was the networking part which gave me the answers I needed.

fisnik
Автор

Excellent explanation ever for docker container and images.
Thank you very much.

talkathiriify
Автор

Nice video, i am looking for this kind of videos. Thaks for your time and effort to make this video 😊

gleamofcolor
Автор

Thank you for this great tutorial.
You explained it verry well!
it helped me understand docker and docker compose.
again thank you for the afford.

suleymanyavas
Автор

Your video is incredible, thanks for the information you share, the only thing missing from the video is talking about volumes.

omartorresrios
Автор

Great explanation, Thank you. Waiting for next session.
if possible can please do video on how microservice communicate to other microservice using service bus and any different ways

chamarthiful
Автор

for someone who struggling when follow the video but cant access sql server after F5, connectionstring should be
$"Data ID=sa;Password={dbPassword}";

bh
Автор

You are awesome! Great video. Keep 'em coming.

qfmrnld
Автор

But the data is gone once you bring it down. You should have included volumes in your tutorial.

OnTheSpurOfTheMoment
Автор

thank you for this useful tutorial .. you said there are 2 networks but you created just one network (Backend) . can you explain more about the second network Frontend ??

xeboytz
Автор

Thanks for this wonderful series, I have a doubt, when you have to choose the target OS (Linux or Windows) if you choose Linux, does it mean it only works on Linux OS? if I wanted to run on both, would I have to create two docker files?

guillermomazzari
Автор

Hi this video is very useful. can you please also use CICD pipelines using Azure DevOps and deploy it on Azure Container Registry and then on Kubernetes.

mohammadhaider
Автор

I did as in tutorial, but after download from docker hub and compose up when i try load page i am getting no response error

necromanta
Автор

Very useful tutorial. But I am curious to know In production environment, is it good idea to use sql server as docker container?
How to handle sql db passwords for production if we use azure to host both app and db. Can you suggest way to deal with it? I am making POC on same so i stucked around it.

vishalpawarsblogs
Автор

Hi! thank you very much for your video! Very simple!
Is it possible to make the data not be deleted from the database every time the application is launched?
And is it possible to somehow enter data into the database without prescribing CRUD? I usually enter the data in the SqlServer itself, but I don't know how to do it with the docker container. Thank you!

jglbesn
Автор

Great Tutorial! I deployed application in docker containenr and connect them each other, But i cannot to run command dotnet ef migrations add createinitial to migration to database. Could you give me some recommend for this?

nhatnguyenthanh