Note: this article is published on 03/09/2023.
This series of articles is about Docker, or Container, due to I cannot get the suitable category, so I designate it to DevOps because the container is used for CI/CD (Continuous Integration and Continue Deployment).
Container (3), Installing SQL Server into Docker --- this article
A - Introduction
Contents of this article:
A - Introduction
B - Overview
What is Container
What is Container Image
C - Find the Image from Docker Hub
D - Pull Microsoft SQL Server Image into Docker
E - Start Docker Container for the SQL Server Image
F - Open Container SQL Server from SSMS
B - Overview
This article will discuss pulling and running an image as a container.
What is a container?
Simply put, a container is a sandboxed process on your machine isolated from all other processes on the host machine.
It is a runnable instance of an image, that can be managed by either DockerAPI (Docker Desktop) or CLI: such as
create,
start,
stop,
move, or
delete
It is runnable on
local machines,
virtual machines or
deployed to the cloud.
It is portable (can be run on any OS).
It is isolated from other containers and runs its software, binaries, and configurations.
What is a container image?
When running a container, it uses an isolated filesystem. This custom filesystem is provided by a container image. Since the image contains the Container’s filesystem, it must contain everything needed to run an application - all dependencies, configurations, scripts, binaries, etc. The image also contains other configurations for the Container, such as environment variables, a default command to run, and other metadata.
C - Find the Image from Docker Hub
Type in docker.com, and log in, you will redirect to hub.docker.com/, or you can type in hub.docker.com/ directly. From Docker Hub, type SQL Server in the search box, and search, you will get:
Microsoft SQL Server

Note: in some cases, especially recently, the search might not go to the Microsoft SQL Server directly. It will list something like this:

But, we still can find the Microsoft SQL Server in the list:

Click that to open the Microsoft SQL Server Page:

Down scrolling, we can see How to use this Image:

Note:
In this article, to set up SQL Server in Docker, we mainly follow these two articles:
How to Deploy & Connect an SQL Server Docker Container - Learn | Hevo (hevodata.com)
How to set up and run SQL Server Docker image (sqlshack.com)
From these two articles, we can get detailed step-by-step explanations. However, for a general case, if we need to install some container image, we can follow the abovementioned method.
D - Pull Microsoft SQL Server Image into Docker:
I assume we have already installed Docker, otherwise, see: Container (2), Docker. Check the Docker version by
Docker -v
We can see that Docker is installed, the version is 20.10.23. Check the Docker images installed:










Join the conversation! Your thoughts help the community grow.