MSSQL Docker on Ubuntu 24.04.

posted in: Uncategorized | 0
0
(0)

Install ndocker engine

https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

# To install latest version of docker
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Test doscker engine
sudo docker run hello-world

Install SQL Server

https://orcacore.com/ms-sql-server-docker-ubuntu22/

# Pull the docker
sudo docker pull mcr.microsoft.com/mssql/server:2022-latest

#Create Container
sudo docker run -e "ACCEPT_EULA=Y" \
-e "MSSQL_SA_PASSWORD=Kleopatra@#4886" \
-p 1433:1433 --name sql1 --hostname sql1 \
-d mcr.microsoft.com/mssql/server:2022-latest

# -v /home/webserver/mssql:/var/opt/mssql microsoft/mssql-server-linux \

# Test 
sudo docker ps -a

Connect

#Start an interactive shell inside your SQL server container by using the command below:
sudo docker exec -it sql1 "bash"

#Then, use the following command tool sqlcmd to connect to your shell:
# -No = encryption optional
/opt/mssql-tools18/bin/sqlcmd -S localhost -U SA -P "p_a_s_s_w_o_r_d" -No

# And then in sqlcmd
1> SELECT Name from sys.databases;
2> GO
quit

#exit docker bash
exit

SQL Server agent

# Enable SQL Server agent
# 1) Start an interactive shell 
sudo docker exec -it --user root sql1 "bash"
# 2) Enable agent inside shell
/opt/mssql/bin/mssql-conf set sqlagent.enabled true
# 3) Exit docker bash
exit
# 4) Restart SQL docker
sudo docker restart sql1

Azure Data Studio

https://learn.microsoft.com/en-us/azure-data-studio/download-azure-data-studio?tabs=linux-install%2Cwin-user-install%2Cubuntu-install%2Cwindows-uninstall%2Credhat-uninstall#linux-installation

# Download it with browser:
#https://azuredatastudio-update.azurewebsites.net/latest/linux-deb-x64/stable

cd ~
sudo dpkg -i ./Downloads/azuredatastudio-linux-<!!! VERSION STRING !!!>.deb

azuredatastudio

#Then install extension Admin Pack for SQL Server (to see Agent in Manage)

Did you like this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Follow jiri_klokocka:

Latest posts from