Search Results for “#docker”

Page 1 of 1

Install SQL Server 2022 with Full-Text Search on Apple Silicon Macs

It looks like a recent change to Docker has allowed Macs with Apple Silicon to run a full installation of Microsoft SQL Server 2022 with full-text search in a Docker container.

How is this possible? Docker has a new feature that can use Rosetta 2 for x64 emulation. That means it supports creating an x64-based Linux image/container and installing the free but full version of SQL Server with FTS.

Step 0: Enable Rosetta in Docker

Enable this feature in the Docker settings as seen in the image below. Look in Settings => Features in development.

Step 1: Create The Dockerfile

Take the content below and save it as a text file named Dockerfile. This configuration creates an Ubuntu 20.04 image, then installs the Microsoft package repositories, SQL Server 2022, FTS, and MS Tools.

# Docker image with msssql 2022 with full text search enabled;
# Based on work in: https://github.com/Microsoft/mssql-docker

# Base OS layer: Latest Ubuntu LTS
FROM --platform=linux/amd64 ubuntu:focal

# Install prerequistes since it is needed to get repo config for SQL server
RUN export DEBIAN_FRONTEND=noninteractive && \
    apt-get update && \
    apt-get install -yq curl apt-transport-https gnupg && \
    # Get official Microsoft repository configuration
    curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
    curl https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb --output packages-microsoft-prod.deb && dpkg -i packages-microsoft-prod.deb && \
    curl https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2022.list | tee /etc/apt/sources.list.d/mssql-server.list && \
    apt-get update  && \
    # Install SQL Server from apt
    apt-get install -y mssql-server && \
    # Install optional packages
    apt-get install -y mssql-server-fts && \
    ACCEPT_EULA=Y apt-get install -y mssql-tools && \
    # Cleanup the Dockerfile
    apt-get clean && \
    rm -rf /var/lib/apt/lists

# Run SQL Server process
CMD /opt/mssql/bin/sqlservr

Step 2: Build The Dockerfile

This will build the Dockerfile and create a Docker image named sqlserver.

docker build -t "sqlserver:latest" .

Step 3: Run the Container

This will create a container from the new image and run it. The sa user will have a password of P@ssw0rdz!, the EULA will be accepted, and port 1433 will be opened.

docker run -d --platform linux/amd64 --name sqlserver -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=P@ssw0rdz!' -p 1433:1433 sqlserver:latest

At this point you should have SQL Server running! You can also have it start up with Docker by executing the command below:

docker update --restart=always sqlserver

#docker #code #mssql #AppleSilicon #YOUREWELCOME

Apr 27, 2023

Page 1 of 1
Pageof 1

Copyright © 2024 Michael Argentini. All rights reserved.