How to run SQL server in a Docker container?
1. 1. At first open PowerShell as Administrator. To pull
the SQL Server 2019 container image from Microsoft Container Registry, use the
following command
docker pull mcr.microsoft.com/mssql/server:2019-latest

2. 2. To run the container image with Docker, you can use the following command from PowerShell command prompt.
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=@Passw0rd" ` -p 1401:1433 --name sql1 --hostname sql1 `
-d mcr.microsoft.com/mssql/server:2019-latest
sqsql1 is here instance/server name and 1401:1433 is here TCP port number
3.
3. To view your Docker containers, use the docker ps
command.
docker ps -a
4. 4. If the STATUS column shows a status of Up, then SQL Server is running in the container and listening on the port specified in the PORTS column.

5.
5. Now open SSMS and connect the newly created SQL
server instance on docker.
Login: sa
Password: P@ssword
Comments
Post a Comment