Skip to content

Commit ab8c26a

Browse files
authored
Add SQL Server 2017 with RHEL 8 example
1 parent 2abc4e5 commit ab8c26a

File tree

1 file changed

+27
-0
lines changed
  • linux/preview/examples/mssql-rhel8-sql2017

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# SQL Server 2017 on RHEL 8 ubi Sample
2+
# This is a sample script shared to help create the SQL Server 2017 containers images based on RHEL 8
3+
# This script can be modified to add other SQL Server components like polybase, Full text search, and others.
4+
# Base OS layer: latest RHEL 8 ubi image
5+
FROM registry.access.redhat.com/ubi8:latest
6+
7+
# 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.
8+
# Adding repositories and installing SQL Server and tools packages
9+
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 && \
10+
curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/8/mssql-server-2017.repo && \
11+
curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/8/prod.repo && \
12+
ACCEPT_EULA=Y yum -y install --disablerepo "*" --enablerepo ${REPOLIST} --setopt=tsflags=nodocs \
13+
mssql-server mssql-tools unixODBC-devel && \
14+
yum clean all
15+
16+
## Adding the required non-root mssql user and also giving access to the mssql server folders
17+
RUN useradd -M -s /bin/bash -u 10001 -g 0 mssql
18+
RUN mkdir -p -m 770 /var/opt/mssql && chown -R mssql. /var/opt/mssql
19+
20+
## Containers not to be run as root, so accessing it as mssql user.
21+
USER mssql
22+
23+
# Default SQL Server TCP/Port
24+
EXPOSE 1433
25+
26+
# Run SQL Server binary
27+
CMD ["/opt/mssql/bin/sqlservr"]

0 commit comments

Comments
 (0)