Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing MSSQL server using docker with full text search support

I am using mssql express for ubuntu on docker. I just found that it does not support full text search. I believe the mssql express supports this, but found no way to enable this feature.

Here is the image I'm using.

image: mcr.microsoft.com/mssql/server:2017-latest-ubuntu

I am passing express edition as environment as MSSQL_PID: "Express".

How can I have full text search installed on the same image ?

like image 802
Krunal Avatar asked Apr 15 '26 07:04

Krunal


2 Answers

If you have an existing container and don`t want to build a custom image do the following steps in your cmd

docker exec -u 0 -it containername /bin/bash
apt-get update
apt-get install -yq curl apt-transport-https gnupg
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/22.04/mssql-server-2022.list | tee /etc/apt/sources.list.d/mssql-server-2022.list 
apt-get update
apt-get install -y mssql-server-fts
apt-get clean && rm -rf /var/lib/apt/lists/* && rm -rf /*.deb

And then Restart your container.

To check if it is working, run the following query(Should return 1)

SELECT FULLTEXTSERVICEPROPERTY('IsFullTextInstalled')
like image 142
Shervin Ivari Avatar answered Apr 17 '26 21:04

Shervin Ivari


Default mssql docker image does not support fts, i.e. full text search, therefore we need to create the custom sql image.

Here is the dockerfile for the same... based on the microsoft repo at https://github.com/Microsoft/mssql-docker/blob/master/linux/preview/examples/mssql-agent-fts-ha-tools/Dockerfile

# Maintainers: Microsoft Corporation (twright-msft on GitHub)
# GitRepo: https://github.com/Microsoft/mssql-docker

# Base OS layer: Latest Ubuntu LTS
FROM ubuntu:16.04

# 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 && \
    # Get official Microsoft repository configuration
    curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
    curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.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-ha && \
    apt-get install -y mssql-server-fts && \
    # Cleanup the Dockerfile
    apt-get clean && \
    rm -rf /var/lib/apt/lists

# Run SQL Server process
CMD /opt/mssql/bin/sqlservr
like image 35
Krunal Avatar answered Apr 17 '26 21:04

Krunal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!