Skip to main content
Version: v26.0-RC

Build the DxEMSSQL Container Image

Introduction

DH2i provides a customized DxEnterprise package that is tailored specifically for container deployments. This quick start guide describes how to build a DxEnterprise + SQL Server container image using DH2i-provided container build files.

Prerequisites

  • A Linux machine with a supported container runtime installed.
    Supported runtimes: Docker or Podman.
    Refer to the official Docker or Podman documentation for installation instructions.

  • Access to a container image registry (for example, Docker Hub or a private registry) where the built image can be tagged and pushed.

  • An internet connection for downloading the DxEnterprise container tarball.

Create the SQL Server and DxEnterprise Combined Container Image

First you will create a custom container image that combines the SQL Server base image with a customized DxEnterprise package designed specifically for container deployments.

  1. Copy the contents of the container build file below to a file in your current working directory.

    info

    This image is built from the mcr.microsoft.com/mssql/server:2019-latest base image. This image:

    1. Installs .NET Runtime 8.0 and net-tools. net-tools is not required for the container to run, but it may help with diagnosing network issues.

    2. Downloads the latest DxEnterprise container package from https://repos.dh2i.com/container/, unpacks it, and configures the required permissions.

    3. Assigns the default user as mssql and sets the entrypoint to a pre-defined startup script. Additional modifications to this script are not supported by DH2i.

    FROM mcr.microsoft.com/mssql/server:2019-latest
    USER root
    # Install dotnet and net-tools
    RUN apt-get update \
    && ACCEPT_EULA=Y apt-get upgrade -y \
    && apt-get install -y wget \
    && wget --no-dns-cache https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
    && dpkg -i packages-microsoft-prod.deb \
    && apt-get update \
    && apt-get install -y dotnet-runtime-8.0 net-tools \
    && dpkg --purge packages-microsoft-prod \
    && apt-get purge -y wget \
    && apt-get clean \
    && rm packages-microsoft-prod.deb \
    && rm -rf /var/lib/apt/lists/*
    # Download and unpack DxE, setup permissions
    ADD https://repos.dh2i.com/container/ ./dxe.tgz
    RUN tar zxvf dxe.tgz && rm dxe.tgz \
    && chown -R mssql /var/opt/mssql \
    && chmod -R 777 /opt/dh2i /etc/dh2i
    # Finish setup
    EXPOSE 7979
    ENV DX_HAS_MSSQLSERVER=1 \
    MSSQL_ENABLE_HADR=1
    USER mssql
    ENTRYPOINT ["/opt/dh2i/sbin/dxstart.sh"]
  2. Replace the <repository_name> variable in the command below with the name of your registry, repository, and tag (for example, dh2i/dxemssql:mytest), then build the image.

    sudo docker build -t <repository_name> -f dxemssql.dockerfile ./

Push the Image to a Repository

note

When using Podman, image names must be fully qualified with the registry name (for example, docker.io/dh2i/dxemssql).

Pushing the image to a container registry allows you to access the image from systems other than the machine it was built on. This step is required for deployments in Kubernetes or other cloud platforms.

  1. Authenticate to your container registry on the local machine.

    sudo docker login
  2. Push the image to the registry, replacing <repository_name> with the image tag you used in the previous section.

    sudo docker push <repository_name>

Next Steps

Once the image is uploaded to a container registry, you can deploy it in your environment. DH2i provides documentation that describes how to use the DxEMSSQL image in various deployment scenarios:

Additional Information