Install MS SQL Server 2022 to Ubuntu 22.04 server using Docker

posted in: Nezařazené | 0
0
(0)

Source Link1, Link2 (MS documentation)

And here is the link for standard (non-docker) instalation procedure of MSSQL 2022. This doesn’t work for now (12/2022) because it is for ubuntu 20.04.

Install Docker

sudo apt update
sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

Add docker repository

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Update Ubuntu

sudo apt update

Install Docker

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

Run Docker & check if running

sudo service docker start
sudo service docker status

Install MSSQL2022 on Docker

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

Create Docker container (Change STRONG password !!!)

sudo docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=<YourStrong@Passw0rd>" \
   -p 1433:1433 --name sql1 --hostname sql1 \
   -d \
   mcr.microsoft.com/mssql/server:2022-latest

Check if Docker container runs

sudo docker ps -a

Start / Stop Docker container (start, restart, stop)

sudo docker start sql1
sudo docker stop sql1
//remove docker container
sudo docker rm sql1

Setting docker container to start at system startup (Link, Link2)

sudo docker run -d --restart unless-stopped sql1
sudo docker update --restart unless-stopped sql1

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