Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the advantages of running SQL Server in a Docker container?

I need to run an SQL Server (Express) instance on my dev machine to work with a web application.

I recently started working with Docker and I'm wondering if there is some advantage using the Microsoft SQLServer Docker image instead of simply installing SQL Server on my machine.

I'm working on a Win10 machine.

like image 371
davioooh Avatar asked Feb 23 '19 11:02

davioooh


People also ask

Can I run SQL Server in a Docker container?

You can now install SQL Server on Linux distributions like the RHEL, SUSE, Ubuntu, etc. However, in order to install and use SQL Server on a Mac, you need to run the Linux distribution inside a docker container.

Is it a good idea to Dockerize a database?

Docker is great for running databases in a development environment! You can even use it for databases of small, non-critical projects which run on a single server. Just make sure to have regular backups (as you should in any case), and you'll be fine.

What is container SQL Server?

SQL Server running as a container with a microservice-related database. In eShopOnContainers, there's a container named sqldata , as defined in the docker-compose. yml file, that runs a SQL Server for Linux instance with the SQL databases for all microservices that need one.


1 Answers

Fast installation

Better to say no installation needed if you already have Docker installed. Just provide 3 env vars (Server type, password and accept EULA) to docker run and you're ready.

Automatic installation/deploy

You can start SQL with just few commands, no need for user interactive process. Very useful for CI/CD pipeline.

Cloud-ready

Want to run you solution on VPS? Or GCP/AKS/AWS? You are just one step away from kubernetes - your containers can be run anywhere.

Cheap

Windows-based virtual servers are more expensive than Linux. Testing your solution could be done on Linux runners and save you money.

Testing against different servers/version

Following @DanGuzman 's comment, you can test your solution with different version on SQL server with just changing the tag of an image or SQL Server type in environment var.

Isolation

Easily create separate bridge networks with SQL server, control access. Can start several instances on one PC at once easily with just separating networks by Docker means.

Resetting

Testing requires that you can reset all changes and start all tests from scratch (from same starting point). With containers and their volumes you achieve that with one command.

Transparent configuration

You provide Dockerfile and docker-compose.yml where all steps are explicitly written clear. No need to provide additional readme's on how to setup your server.

Cross-platform

Developers can use different operating systems when working on big project (our case). Docker configuration will run on any without changes. Maybe you designes use MacOS and also want to run solution locally? Easy with Docker.

like image 183
grapes Avatar answered Sep 18 '22 08:09

grapes