I keep all my databases, queues and other infrastructure tools on a linux box running as docker containers. Docker gives me the flexibility of installing multiple things without messing up my dev environment and I recently added SqlServer
sudo docker pull mcr.microsoft.com/mssql/server
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo nano docker-compose.yml
and type the following: (The configuration below will run the sql server container in the developer edition)
version: '3'
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:latest
container_name: sqlserver1
restart: always
environment:
- "ACCEPT_EULA=Y"
- "MSSQL_SA_PASSWORD=<YourStrong!Passw0rd>"
volumes:
- ./data/sqlserver1/:/var/opt/mssql
ports:
- "1433:1433"
now we can start docker compose
sudo docker-compose up
and make sure sql server is up
sudo docker ps -a
you should see the following
![alt text](/imgs/0002 - sql server on linux.jpg “SqlServer”)
Now that the server is up and running and the container is exposed to connections outside the docker, we are able to use it normally and connect to it via SSMS or our application.