Containerize a .NET Core app

Essential commands

Docker has many different commands that create, manage, and interact with containers and images. These Docker commands are essential to managing your containers:

Here an example:
https://docs.microsoft.com/en-us/dotnet/core/docker/build-container

(from Visual Studio 2019 it is possible to add Docker support):

Opzione di menu Aggiungi Supporto Docker in Visual Studio

Docker commands

Pull down the SQL Server Docker Image from DockerHub
docker pull microsoft/mssql-server-linux:2017-latest

Create a Docker container using the microsoft/mssql-server-linux:2017-latest
Automatically accept the EULA, set the password to for the sa user, and map port container port 1433 to host port 1433
docker run --name sql \
-e 'ACCEPT_EULA=Y' \
-e 'SA_PASSWORD=' \
-p 1433:1433 \
-d microsoft/mssql-server-linux:2017-latest

Check if the container is up (running) – in STATUS column
sudo docker ps -a

To stop the container (assuming its name is “sql”) just type
docker stop sql
Now, typing sudo docker ps -a the container STATUS is Exited

To restart the container just type
docker start sql

Test the connection with Azure Data Studio or SQLPro for MSSQL

Here there is a Microsoft Reference Guide on Docker

Deletes pulled images with IMAGE ID 810001cb03af
docker images | grep 810001cb03af | awk '{print $1 ":" $2}' | xargs docker rmi