Azure SQL Edge Database Engine using Docker

Azure SQL Edge is a containerized database engine designed for use in edge and disconnected environments, where there is limited or no connectivity to the cloud. With Azure SQL Edge, you can deploy a lightweight, secure and reliable database engine on a wide range of edge devices and sensors, including industrial equipment, IoT gateways and mobile devices.

In this blog post, we will walk you through the process of using Docker to install and run the Azure SQL Edge database engine on your local machine.

Prerequisites:

  • A machine running Docker

Step by Step

Step 1: Download the Azure SQL Edge Docker image The first step is to download the Azure SQL Edge Docker image from the Microsoft Container Registry. To do this, open up a terminal or command prompt and run the following command:

docker pull mcr.microsoft.com/azure-sql-edge

This command will download the latest version of the Azure SQL Edge Docker image to your local machine.

Step 2: Run the Azure SQL Edge Docker container Once you have downloaded the Azure SQL Edge Docker image, you can use it to create a container. To do this, run the following command in your terminal:

docker run --cap-add SYS_PTRACE -e 'ACCEPT_EULA=1' -e 'MSSQL_SA_PASSWORD=FollowMe!' -p 1433:1433 --name azuresqledge -d mcr.microsoft.com/azure-sql-edge

This command will start a new container from the Azure SQL Edge Docker image, and expose port 1433 to the host machine. It also sets the ACCEPT_EULA and SA_PASSWORD environment variables, which are required for the container to start up.

Step 3: Connect to the Azure SQL Edge container using SQL Server Management Studio Once the container is up and running, you can connect to it using SQL Server Management Studio (SSMS). To do this, open SSMS and connect to the server localhost,1433. Use sa as the login and the password you set in the previous step.

Step 4: Running a Docker container using the -v option allows you to mount a volume to the container. This means that you can share files and directories between the container and the host machine, and persist data between container sessions.

Run the container using the -v option Now that you have the Azure SQL Edge container image, you can use the -v option to mount a volume to the container. To do this, run the following command in your terminal:

docker run --cap-add SYS_PTRACE -e 'ACCEPT_EULA=1' -e 'MSSQL_SA_PASSWORD=FollowMe!' -p 1433:1433 --name azuresqledge -v sqlvolume:/var/opt/mssql -d mcr.microsoft.com/azure-sql-edge

Summary

In this blog post, we have discussed how to use Docker to install and run the Azure SQL Edge database engine on a local machine. We have covered the steps required to download the Azure SQL Edge Docker image, create a container from the image, and connect to the container using SQL Server Management Studio. We have also shown how to mount a volume to the container, allowing us to share files and directories between the container and the host machine, and persist data between container sessions. With these steps, you can set up and test the Azure SQL Edge database engine on your local machine, allowing you to develop and test edge applications that use Azure SQL Edge.

Victor Yoalli

This is me.