- Pull the docker image from Microsoft repo
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 imagesdocker 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-worlddocker start -a containerID
Some important docker commands:
docker version -
docker info
docker run
docker search
docker pull
docker images
Docker ps -a