8 Nov 2025
Running a SQL Server on Linux Container
- Pull the image
- Docker pull mcr.microsoft.com/mssql/server:2017-CU14-ubuntu
- Run the container
- Docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=D0cker@098!QAZ" -p 1433:1433 --name sqldevlinuxcon01 -d -h linuxsqldev01 mcr.microsoft.com/mssql/server:2017-CU14-ubuntu
- -e : sets required env. Variables for SQL
- -p : publishes container's TCP port(range) to the host - ip:hostPort:containerPort - mapping port 1433 on the host to port 1433 on the container
- --name : custom name to help ifentify the container instead of a system-generated one
- -d : runs the container in detached mode (background process) and prints the container ID. It ensures container still runs in background post docker run command.
- -h : server hostname that you want to assign to the container
- Check for errors/status of containers
- Docker images
- Docker ps -a
Lifecycle of a container:
- Docker ps -a
- Created: when you create a container using docker create command but not run it
- Running: This is when container is up and running and doing its job
- Exited: This is when container has gone through running and completed its job. When primary process is not running, the container exits
- Paused: This is when you choose to pause the container using docker pause command, suspending all the processes
- Restarting: A container where a restart policy has been configured
- Dead: This is when a docker daemon attempted to stop the container but failed
- Docker run = docker create + docker start
- Docker create hello-world
- Docker start -a containerID
Some important docker commands:
Docker version -
Docker info
Docker run
Docker search
Docker pull
Docker images
Docker ps -a