Microsoft SQL Server on Docker on Apple Mac Silicon

While reinstalling my system I needed to have Microsoft SQL Server running on my new Apple Mac (which contains an M2 chip). There are various posts online about this, but the following worked for me.
- Install Docker Desktop
- Go to the settings and find the "Features in Development" tab and enable "Use Rosetta for x86/amd64 emulation on Apple Silicon"

Once done you can get Microsoft SQL Server running on you machine by simply executing the following commands:
# Pulls the image
docker pull mcr.microsoft.com/mssql/server:2022-latest
# Starts the server
# NOTE: The `--platform linux/amd64` ensures that it runs in the correct mode
# NOTE: The Password must be strong, so please change
docker run --platform linux/amd64 -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=DevPassword123" -p 1433:1433 --name sql1 --hostname sql1 -d mcr.microsoft.com/mssql/server:2022-latest
After all that simply run your favorite tool for connecting to the database and it should work.