Skip to content

volkb/dokcer-sql-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker with MSSQL Server 2019

Note: This guide will allow you to containerize sqlserver; however, you must go into docker's settings and assure proper # cores and memory is allocated as large queries will take a very long time otherwise

  1. Ensure that docker is installed on your system. If you are a Windows user, and using Docker desktop, recent versions enforce the use of a WSL based engine. To set that up follow the MS guide here. If you are a Windows home user, make sure to use the WSL 2 instructions.

  2. Create a .env file on the root of the project at the same level as the docker-compose.yml and define the following, ensure that the passwords you set follow the SQLServer password requirements found here:

    SA_PASSWORD=<YOUR-DB-PASSWORD>
    ACCEPT_EULA=Y
    USERNAME=<YOUR-USERNAME>
    PASSWORD=<YOUR-PASSWORD>
    
  3. Create your script for restoring the database. Use the following command to assist you in getting the names of the .mdf and .ldf in your backup. RESTORE FILELISTONLY FROM DISK='<PATH-To-YOUR-BACKUP-FILE>' WITH FILE=1

  4. create a folder in the /Docker directory called 'databases' any current .mdf files you have can be added in here and will be moved into the Docker container on build

  5. Open a terminal (for windows use Powershell), and cd into the directory of the docker-compose file

  6. Run docker-compose up --build and wait for the terminal to read "Finished setup script"

  7. open Sql Server mgmt studio and login, your options should read as follows:

    Server type: Database Engine
    Server name: localhost,1433
    Authentication: SQL Server Authentication
    Login: sa
    Password: [whatever password you set for SA_PASSWORD in the .env file mentioned above]
    
  8. Begin working. Any .mdf or other database files placed in the /Docker/databases directory will appear in the /tmp directory

  9. When you are finished working, simply open a terminal (for windows use Powershell) and run docker-compose down this will turn off the server, freeing system resources and re-openeing port 1433

About

a simple docker build for MS SQL Server 2019

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors