DEV Community

David
David

Posted on

1

How to run SQL Server on M1/M2 with Docker

Pull the image by opening up a terminal and running the command

docker pull mcr.microsoft.com/azure-sql-edge`
Enter fullscreen mode Exit fullscreen mode
docker run --cap-add SYS_PTRACE -e 'ACCEPT_EULA=1' -e 'MSSQL_SA_PASSWORD=your_strong_password' -p 1433:1433 --name azuresqledge -d -v sqlvolume:/var/opt/mssql mcr.microsoft.com/azure-sql-edge
Enter fullscreen mode Exit fullscreen mode

–cap-add SYS_PTRACE – here is Microsoft’s note on this line: The --cap-add SYS_PTRACE flag is required for non-root SQL Server containers to generate dumps for troubleshooting purposes

-e ‘ACCEPT_EULA=1’ is an environment variable, which is saying that we will accept the End User License Agreement.

-e ‘MSSQL_SA_PASSWORD=your_strong_password’ – this is setting the password for the sa (the system administrator) user. This is how you will log into the database. By default the username is ‘sa’.

-p 1433:1433 is mapping ports. The left side of the colon is the port on the host (your mac). The right side is the port used inside the container

–name azuresqledge is just giving the container a more user-friendly name after it starts running

-d is detached mode. This means that the terminal won’t attach to the process, which means it’ll start the container up and then give you terminal control back, so you can run other commands.

-v sqlvolume:/var/opt/mssql is to persist the data

mcr.microsoft.com/azure-sql-edge is last and it’s the name of the image. This is the same name used in the docker pull command

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up