Sign inSign up

ajinnov/mssql-server-linux-dev

By ajinnov

•Updated over 6 years ago

A docker image to run a convenient SQL SERVER for developers

Image
0

1.1K

ajinnov/mssql-server-linux-dev repository overview

⁠Docker SQL Server for Dev

This image allows you to quickly start a SQL Server 2017 server in Docker for the testing needs of development teams. It uses Google Cloud Storage to retrieve SQL files to create tables and databases.

⁠Quickstart

To start you're gonna need:

  • A Google Cloud project
  • A Google Cloud service account key
  • A GCS bucket
  • Your .sql files
  1. Create a file named .env containing the required env variables :
touch .env
Variable NameDescriptionRequiredDefault
MSSQLDEV_GOOGLE_PROJECT_NAMEThe name (ID) of your GCP projectyes
MSSQLDEV_GCP_SA_EMAILGoogle cloud service account e-mailyes
MSSQLDEV_GCP_SA_KEY_PATHPath to the service account json key (mounted as volume or copied inside the container)yes or default/home/mssql/secrets
MSSQLDEV_BUCKET_NAMEName of the bucket containing your .sql filesyes
ACCEPT_EULAWether or not you accept MSSQL EULAyes (Must be yes for the server to start)
SA_PASSWORDPassword of the user SA of MSSQL Serveryes

Example of .env file :

MSSQLDEV_GOOGLE_PROJECT_NAME=myproject
MSSQLDEV_GCP_SA_EMAIL=myserviceaccount@myproject.iam.gserviceaccount.com
MSSQLDEV_GCP_SA_KEY_PATH=/home/mssql/secrets

ACCEPT_EULA=Y
SA_PASSWORD=MyStrongPassword@
  1. Make sure your designated bucket file tree is like :
- databases
-- my_db_1_.sql
- tables
-- my_table_1.sql
  1. You can either build this image
docker build . -t ajinnov/mssql-server-linux-dev:release-1.0.0

... or use the public build :

https://hub.docker.com/r/ajinnov/mssql-server-linux-dev⁠

ajinnov/mssql-server-linux-dev:release-1.0.0
  1. And run it ...
docker run -d -v $(pwd)/secrets:/home/mssql/secrets -v mssql_for_dev_data:/var/opt/mssql \
--env-file=$(pwd)/.env \
 --name sql1 -p 1434:1433 \
 ajinnov/mssql-server-linux-dev:release-1.0.0

If you want to update your database, simply add the files in your bucket and run

docker exec -it MY_CONTAINER_NAME /home/mssql/update_sql_from_gcs.sh

⁠Acknowledgements

This image is based on mcr.microsoft.com/mssql/server:2017-latest

Tag summary

Content type

Image

Digest

Size

604.4 MB

Last updated

over 6 years ago

docker pull ajinnov/mssql-server-linux-dev