Think of this Docker image as a ready-to-go SQL Server that automatically does your homework setup for you.
Instead of installing Microsoft SQL Server manually and running a huge script to create tables and fill them with fake students, grades, and payments, this image does it all automatically when it starts.
To use this image, you need to run a command in your terminal (PowerShell, Command Prompt, or Terminal).
Here is the best command to copy and paste to get started immediately:
docker run -e "INIT_DEFAULT_DB=TRUE" -e "LAB=1" -e "VARIANT=5" -p 1433:1433 --name sql_lab_1 tohun/mssql-lab
You can customize how the database is built by changing the "Environment Variables" (the -e flags in the command above). Here is what each one does:
| Setting | Default | Description |
|---|---|---|
INIT_DEFAULT_DB | FALSE | Important: You must set this to TRUE if you want the container to automatically create your tables and data. If you leave it FALSE, you get an empty server. |
LAB | 1 | Tells the container which lab script to run. If you are doing Lab 1, set this to 1. If you are doing Lab 4, set this to 4. This picks the correct .sql file to execute. |
VARIANT | 1 | This is your personal "Variant" number. It changes the random data generation (like how many students or how much money is in the payments table), so your database looks slightly different from your classmate's. |
DB_NAME | DEFAULT_DATABASE | The name of the database that will be created. You can change this to MyLabDB or anything you like (mostly used for Lab 1). |
MSSQL_SA_PASSWORD | Lab_Password!123 | The master password to log in. You can change it, but make sure it is strong (SQL Server requires complex passwords), or just use the default provided here. |
Once the container is running, you can connect to it using SSMS (SQL Server Management Studio), DBeaver, or Azure Data Studio.
localhost,1433saLab_Password!123 (or whatever you changed it to)INIT_DEFAULT_DB=TRUE, it looks at which LAB number you chose.setup_lab_1.sql) to create tables (Students, Payments, etc.) and generates thousands of rows of fake data based on your VARIANT.setup_completed.flag. This ensures that if you restart the container, it doesn't try to overwrite your database again.docker run command:
-v sql_data:/var/opt/mssql/datadocker logs sql_lab..sql files you want to run automatically, you can put them in a folder and map it to /docker-entrypoint-initdb.d inside the container. The image is built to run any extra SQL files found there automatically!Content type
Image
Digest
sha256:549b4b483…
Size
589.2 MB
Last updated
4 months ago
docker pull tohun/mssql-lab