Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Develop SQL Server databases on RHEL with Podman Desktop

December 9, 2024
Louis Imershein
Related topics:
ContainersDatabasesLinuxKubernetes
Related products:
Podman DesktopRed Hat Enterprise Linux

Share:

    It is no secret that Microsoft SQL Server containers are based on Linux, and that Microsoft has seen millions of SQL Server container downloads. What is less known is that these containers are using the same SQL Server engine you use in your production environments, even if they are deployed and managed through a traditional package-based installation such as the one you might be used to on Windows, or the one Microsoft certifies on Red Hat Enterprise Linux (RHEL). 

    SQL Server on RHEL containers are free for development use, which makes this whole process super easy. If you are a Microsoft SQL Server developer, using containers allows you to spin up database instances with minimal overhead, this is ideal for development and testing. When you want to move to production, you can easily just backup the data from your container and restore into a production environment, even one that’s package based. 

    Whether you’re developing your Microsoft SQL Server applications on Microsoft Windows, or your company is standardizing on RHEL, Podman Desktop is the preferred tool for developing your SQL Server applications that are targeting the Red Hat Enterprise Linux platform. Podman Desktop helps you create, deploy and manage SQL Server containers for development. To start developing with SQL Server on RHEL containers, download Podman Desktop.

    In this article, we’re going to look at just how easy it is to get up and running with all the tools we need for a SQL Server on Red Hat Enterprise Linux development environment. If you aren’t familiar with RHEL, you can visit our product page to learn more. You can also install Podman Desktop on Microsoft Windows and the experience we’re going to walk through will be identical to the one on RHEL. 

    Install and run Podman Desktop

    For RHEL, we’ll use the following instructions to install Podman Desktop. I’ve already installed the RHEL 10 Beta release, but you can install Podman Desktop to run SQL Server containers on RHEL 8 or RHEL 9 as well. If you’re new to RHEL, or to Linux in general, you can find a variety of tips on how to work with RHEL on our getting started page.

    We’ll be working from a terminal prompt to install Podman Desktop as a Flatpack via Flathub. To get started, press the Windows key (the key next to the Alt key on your keyboard) and type terminal in the search bar, then press the Enter key.  At this point, the terminal (command line) application will appear. To install Podman Desktop, we enter the following at the terminal application’s command line prompt:

    user@rhel10:~$ flatpak install flathub io.podman_desktop.PodmanDesktop

    Once this process is complete, we’re ready to start Podman Desktop. Again, press the Windows key, and this time type podman into the search bar, then press Enter. The Podman Desktop application will appear, as shown in Figure 1.

    The Podman Desktop application upon launch.
    Figure 1: Starting Podman Desktop.

    Create a persistent volume

    Notice a menu of icons on the left part of the Podman Desktop screen. This is the main navigation for Podman Desktop. We start by selecting the Volumes icon (fifth icon from the top). We will use this to create a persistent volume for use with our SQL Server image. From the Volumes page, select Create in the top right corner. We’ll name our volume sqldata1 and then select Done. Our new volume will be listed on the Volumes page as in Figure 2.

    The Volumes page in Podman Desktop, with the new sqldata1 volume listed.
    Figure 2: The sqldata1 volume shown in Podman Desktop.

    Persistent volumes can be beneficial with SQL Server containers. Microsoft has built in support for multiple Cumulative Updates (CUs) within SQL Server. Suppose we ever need to go back and use an older CU, or move to a newer one. In that case, the data in our persistent storage will automatically be upgraded or downgraded to work with any CU the organization we are developing for has standardized on. All we have to do is download a new container and SQL Server will take care of the rest for our persistent database code and data.

    Pull the SQL Server container image

    From the menu on the left, select the Images icon (the fourth icon from the top). This will take you to the Images page. Select the Pull button (on the top right of the screen), and you will be prompted to provide the path for an Image to pull down. To obtain the latest image for SQL Server 2022, use the following:

    mcr.microsoft.com/mssql/rhel/server:2022-latest

    Containers built on RHEL can be pulled from mcr.microsoft.com/mssql/rhel/ with SQL Server 2017, 2019, and 2022 CUs. If the organization you are developing this application for has standardized on a specific update, it is super easy to just grab that update and develop with it in a native Linux environment. If your company has standardized on a specific version or CU, a list of all the variations available can be found in the Microsoft Artifact Registry.

    After the image download has completed, select Done, and you will see a listing of the downloaded image on the screen (Figure 3).

    The completed image download listed in the Images page in Podman Desktop.
    Figure 3: The completed image download listed on the Images page.

    We have now downloaded the SQL Server image and we can use it to create a database instance for development. 

    Start the container

    Select the play symbol (▶) to the right of the image. After doing so, you'll be prompted for configuration information. You can get started by providing the following:

    Container name: mssql1
    Entry point: /opt/mssql/bin/permissions_check.sh
    Command: /opt/mssql/bin/sqlservr
    Volumes: 
        Path to host: sqldata1   
        Path inside the container: /var/opt/mssql
    Port mapping:
        Local port for 1433/tcp: 1401
    Environment variables:
        Name: ACCEPT_EULA
        Value: Y
        Name: MSSQL_SA_PASSWORD
        Value: VeryStrongPassword

    Select Start Container at the bottom of the screen and you’ll see the log of your SQL Server starting up, as shown in Figure 4.

    SQL Server logs shown in Podman Desktop.
    Figure 4: After initializing the SQL Server container.

    What we’ve done here is create a new container we’ve labeled as mssql1 for management purposes. The container is mapping sqldata1 volume we created earlier to store persistent data for the /var/opt/mssql directory. We’ve started this container on port 1401, which is the port you’ll use to connect to this SQL Server container using your favorite tools. When it comes to tools, pick your poison; whether you use Azure Data Studio, Visual Studio Code, or JetBrains Data Grip, these are just a few of the tools available for SQL Server database development on Red Hat Enterprise Linux. 

    We can develop multiple SQL Server database applications right on the same system at the same time using Podman Desktop as well. For example, alongside our mssql1 container, we could create a container called mssql2 that uses a persistent storage volume we create called sqldata2 and gets served up on port 1402. 

    Create a pod for containers

    Podman Desktop even allows us to create a pod for our containers. Pods allow us to work with multiple containers as a single unit. They can be particularly useful where we have multiple container workloads. One common use is to have a database like SQL Server in one container and a front-end application in another. Pods are easier to manage and simplify networking between related containers; they’re the best way to develop workloads where tight container coordination is needed. 

    To containerize our SQL Server container, from the menu on the left, select Containers (the second icon from the top) and we will be taken to the Containers page. We then select which containers we wish to include in our pod. 

    In this example, we will include a .NET container and our SQL Server container. Select the Create Pod button (near the top of the screen) and we are prompted to name our pod and confirm the containers and ports we wish to expose. In this case, we choose to expose port 8080 as a web server for our .NET application, but we won’t select to expose the SQL Server port. This way, we only allow direct SQL Server connections internally within the pod. Figure 5 shows the Create Pod screen.

    The page for creating a pod in Podman Desktop, with the .NET and SQL Server containers listed.
    Figure 5: Adding the .NET and SQL Server containers to the pod.

    By selecting Create Pod when promoted, our rhel-mssql-workload1 pod is created with the two containers and the exposed ports we specified. We can now quickly stop, start, or restart our workload as a single entity.

    Need to customize your container settings for performance? Well, remember, we’re using a persistent volume for our container. With SQL Server on Linux, most of the system-level tuning is done through the mssql-conf utility. Need to limit the amount of memory that your SQL Server container will use to 2GB? Choose the Terminal option for your container and from a prompt, enter the command: 

    bash-5.1$ /opt/mssql/bin/mssql-conf set memory.memorylimitmb 2048

    You’ll be prompted to restart your container. The easiest way to do this is to simply stop and start the container (or pod) right from Podman Desktop. 

    Conclusion

    Podman Desktop provides an ideal way to create, deploy and manage SQL Server containers for developers and the recommended tool for development of SQL Server on RHEL applications. I strongly recommend you look at using SQL Server on RHEL containers with Podman Desktop for your next SQL Server application development project. 

    • Learn more about SQL Server containers.

    • Learn more about Red Hat Enterprise Linux for developers.

    • For more information deploying and managing SQL Server on RHEL containers in production environments, see my blog on the topic: How to deploy Microsoft SQL Server 2022 containers on Red Hat Enterprise Linux

    • Download Podman Desktop to start developing with SQL Server on RHEL containers today.
    Last updated: December 11, 2024

    Related Posts

    • Working with Kubernetes in Podman Desktop

    • How to install and use Podman Desktop on Windows

    • Experiment and test AI models with Podman AI Lab

    • Master the art of bare metal deployments with image mode for RHEL

    • Get started with bootable containers and image mode for RHEL

    • Deploy and test Kubernetes containers using Podman Desktop

    Recent Posts

    • Speech-to-text with Whisper and Red Hat AI Inference Server

    • How to use Splunk as an event source for Event-Driven Ansible

    • Integrate vLLM inference on macOS/iOS with Llama Stack APIs

    • Optimize model serving at the edge with RawDeployment mode

    • Introducing Red Hat build of Cryostat 4.0

    What’s up next?

    Read Podman in Action for easy-to-follow examples to help you learn Podman quickly, including steps to deploy a complete containerized web service.

    Get the e-book
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue