From 06fd3c2a1578516f071d633f8fc2f4974c7b9987 Mon Sep 17 00:00:00 2001 From: Van To <40007119+VanMSFT@users.noreply.github.com> Date: Tue, 19 Apr 2022 08:10:23 -0700 Subject: [PATCH 1/4] Adding custom SQL Server 2019 Docker file This Dockefile script installs Polybase, FTS with SQL Server, and tools on SQL Server 2019 --- .../examples/mssql-polybase-fts-tools/Dockerfile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 linux/preview/examples/mssql-polybase-fts-tools/Dockerfile diff --git a/linux/preview/examples/mssql-polybase-fts-tools/Dockerfile b/linux/preview/examples/mssql-polybase-fts-tools/Dockerfile new file mode 100644 index 0000000..ad98779 --- /dev/null +++ b/linux/preview/examples/mssql-polybase-fts-tools/Dockerfile @@ -0,0 +1,16 @@ +# Base OS layer: Latest Ubuntu LTS +FROM mcr.microsoft.com/mssql/server:2019-latest +USER root +# Install prerequistes since it is needed to get repo config for SQL server +RUN apt-get update && \ + apt-get install -y software-properties-common && \ + rm -rf /var/lib/apt/lists/* +RUN add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2019.list)" && \ + apt-get install -y mssql-server-fts && \ + apt-get install -y mssql-server-polybase + +EXPOSE 1433 + +USER mssql + +CMD ["/opt/mssql/bin/sqlservr"] From 2abc4e530cecf96cdc63637bc798d4091af7faf3 Mon Sep 17 00:00:00 2001 From: Van To <40007119+VanMSFT@users.noreply.github.com> Date: Tue, 19 Apr 2022 08:12:24 -0700 Subject: [PATCH 2/4] edit --- linux/preview/examples/mssql-polybase-fts-tools/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/linux/preview/examples/mssql-polybase-fts-tools/Dockerfile b/linux/preview/examples/mssql-polybase-fts-tools/Dockerfile index ad98779..586140b 100644 --- a/linux/preview/examples/mssql-polybase-fts-tools/Dockerfile +++ b/linux/preview/examples/mssql-polybase-fts-tools/Dockerfile @@ -13,4 +13,5 @@ EXPOSE 1433 USER mssql +# Run SQL Server process CMD ["/opt/mssql/bin/sqlservr"] From ab8c26a135055b62260d46e26799afc6ae53cd9c Mon Sep 17 00:00:00 2001 From: Van To <40007119+VanMSFT@users.noreply.github.com> Date: Tue, 19 Apr 2022 08:18:22 -0700 Subject: [PATCH 3/4] Add SQL Server 2017 with RHEL 8 example --- .../examples/mssql-rhel8-sql2017/Dockerfile | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 linux/preview/examples/mssql-rhel8-sql2017/Dockerfile diff --git a/linux/preview/examples/mssql-rhel8-sql2017/Dockerfile b/linux/preview/examples/mssql-rhel8-sql2017/Dockerfile new file mode 100644 index 0000000..96347ad --- /dev/null +++ b/linux/preview/examples/mssql-rhel8-sql2017/Dockerfile @@ -0,0 +1,27 @@ +# SQL Server 2017 on RHEL 8 ubi Sample +# This is a sample script shared to help create the SQL Server 2017 containers images based on RHEL 8 +# This script can be modified to add other SQL Server components like polybase, Full text search, and others. +# Base OS layer: latest RHEL 8 ubi image +FROM registry.access.redhat.com/ubi8:latest + +# You need to ensure that the host where you are building this image has repos subscribed that are required to install the package dependencies, like python3, bzip2, and many more. +# Adding repositories and installing SQL Server and tools packages +RUN REPOLIST=rhel-8-for-x86_64-baseos-rpms,rhel-8-for-x86_64-appstream-rpms,packages-microsoft-com-mssql-server-2017,packages-microsoft-com-prod && \ + curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/8/mssql-server-2017.repo && \ + curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/8/prod.repo && \ + ACCEPT_EULA=Y yum -y install --disablerepo "*" --enablerepo ${REPOLIST} --setopt=tsflags=nodocs \ + mssql-server mssql-tools unixODBC-devel && \ + yum clean all + +## Adding the required non-root mssql user and also giving access to the mssql server folders +RUN useradd -M -s /bin/bash -u 10001 -g 0 mssql +RUN mkdir -p -m 770 /var/opt/mssql && chown -R mssql. /var/opt/mssql + +## Containers not to be run as root, so accessing it as mssql user. +USER mssql + +# Default SQL Server TCP/Port +EXPOSE 1433 + +# Run SQL Server binary +CMD ["/opt/mssql/bin/sqlservr"] From 0ebee1b6bbfa0c09a34b66e8e649b1648ca3589e Mon Sep 17 00:00:00 2001 From: Van To <40007119+VanMSFT@users.noreply.github.com> Date: Tue, 19 Apr 2022 08:21:25 -0700 Subject: [PATCH 4/4] Adding SQL Server 2019 on RHEL 7 example --- .../examples/mssql-rhel7-sql2019/Dockerfile | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 linux/preview/examples/mssql-rhel7-sql2019/Dockerfile diff --git a/linux/preview/examples/mssql-rhel7-sql2019/Dockerfile b/linux/preview/examples/mssql-rhel7-sql2019/Dockerfile new file mode 100644 index 0000000..9b8f9bd --- /dev/null +++ b/linux/preview/examples/mssql-rhel7-sql2019/Dockerfile @@ -0,0 +1,25 @@ +# SQL Server 2019 on RHEL 7 sample script +# This is a sample script shared to help create the SQL Server 2019 containers images based on RHEL 7 +# This script can be modified to add other SQL Server components like polybase, Full text search, and others. +# Base OS layer: latest RHEL 7 latest image +FROM registry.access.redhat.com/rhel7:latest + +## Adding the required repos for installing SQL Server, tools, and other dependent packages. +RUN REPOLIST=rhel-7-server-rpms,packages-microsoft-com-mssql-server-2019,packages-microsoft-com-prod && \ + curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2019.repo && \ + curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/7/prod.repo && \ + ACCEPT_EULA=Y yum -y install --disablerepo "*" --enablerepo ${REPOLIST} --setopt=tsflags=nodocs \ + mssql-server mssql-tools unixODBC-devel && \ + yum clean all + +## Providing the required access to the mssql server folders +RUN mkdir -p -m 770 /var/opt/mssql && chown -R mssql. /var/opt/mssql + +## Default SQL Server port +EXPOSE 1433 + +## Running SQL containers as non-root +USER mssql + +## Start SQL server +CMD /opt/mssql/bin/sqlservr