Run Microsoft SQL Server Containerized in Docker

Channel:
Subscribers:
14,500
Published on ● Video Link: https://www.youtube.com/watch?v=9Ajt6TuGQt0



Category:
Tutorial
Duration: 2:32
801 views
18


#SQLServer #Microsoft #Docker #Database

Full steps can be found at https://i12bretro.github.io/tutorials/0879.html

--------------------------------------------------------------------
Installing Docker
--------------------------------------------------------------------
   01. Log into the Linux host and run the following commands in a terminal window
         # install prerequisites
         sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y
         # add docker gpg key
         curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
         # add docker software repository
         sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
         # install docker
         sudo apt install docker-ce docker-compose containerd.io -y
         # enable and start docker service
         sudo systemctl enable docker && sudo systemctl start docker
         # add the current user to the docker group
         sudo usermod -aG docker $USER
         # reauthenticate for the new group membership to take effect
         su - $USER
 
--------------------------------------------------------------------
Running MS SQL Server Container
--------------------------------------------------------------------
   01. Continue with the following commands in a terminal window
         # create working directory structure
         mkdir ~/docker/mssql -p
         # set owner of working directories
         sudo chown "$USER":"$USER" ~/docker -R
         # allow the container to write to working directories
         sudo chmod a+rwx -R ~/docker/mssql
         # run the sql server docker container with persistent data
         docker run -d --name mssql -e ACCEPT_EULA=Y -e MSSQL_SA_PASSWORD='Something$ecur3!' -v ~/docker/mssql:/var/opt/mssql -p 1433:1433 --restart unless-stopped mcr.microsoft.com/mssql/server
   02. At this point the SQL Server instance is running and can be interacted with via the sqlcmd command line interface
         # connect to the database via sqlcmd
         # authenticate with the sa password set in the docker run command
         docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -U SA
         # output the SQL version
         select @@version;
         go
 
--------------------------------------------------------------------
Installing SQL Server Management Studio (optional)
--------------------------------------------------------------------
NOTE: SQL Server Management Studio (SSMS) is currently only available for Windows hosts
 
   01. Log into a Microsoft Windows host
   02. Download SQL Server Management Studio (SSMS)  https://aka.ms/ssmsfullsetup
   03. Navigate to the download directory and execute the downloaded SSMS Setup installer ≫ Click Install
   04. Once the installation completes, click Close
   05. Launch SSMS from the Start menu
   06. Complete the Connect to Server form with the following
         Server type: Database Engine
         Server name: ≪%Docker host DNS or IP%≫
         Authentication: SQL Server Authentication
         Login: sa
         Password: ≪%MSSQL_SA_PASSWORD%≫
 
Documentation:  https://learn.microsoft.com/en-us/sql/linux/sql-server-linux-docker-container-deployment
 


### Connect with me and others ###
★ Discord: https://discord.com/invite/EzenvmSHW8
★ Reddit: https://reddit.com/r/i12bretro
★ Twitter: https://twitter.com/i12bretro







Tags:
Container
Containerization
Docker
Docker Container
Docker Host
Docker Installation Tutorial
Docker Made Easy
Docker Made Simple
Docker Setup Tutorial
Docker Simplified
Docker Tutorial
Home Lab
Home Lab Ideas
How To
Install Guide
Linux
MSSQL
Microsoft
Microsoft SQL Server
SQL Server
SQL Server Docker Container
SQL Server Management Studio
SSMS
Self-Hosted
Tutorial
i12bretro