Skip to content

Instantly share code, notes, and snippets.

@ogryzek
Last active September 11, 2024 13:56
Show Gist options
  • Save ogryzek/7c1a5fdaca2efac698368ada0d9a30cd to your computer and use it in GitHub Desktop.
Save ogryzek/7c1a5fdaca2efac698368ada0d9a30cd to your computer and use it in GitHub Desktop.

Docker, Adventureworks and macOS.

This is mostly just the result of some searching, troubleshooting and setup for Docker, AdventureWorks, and Azure Data Studio on macOS.

References:

Download AdventureWorks data

Get the AdventureWorks Sample Database, and save it somewhere. In this case, we save AdventureWorks2022.bak to the Desktop for use in a later step.

Using the terminal:

Use docker pull to download the Azure SQL Edge container image

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

Run a container using the Azure SQL Edge container image with some parameters:

docker run -d --name SQLEdge -p 6666:1433 -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=w0nD3rFuuull" -e "MSSQL_PID=Developer" mcr.microsoft.com/azure-sql-edge

Create directory and copy the .bak file:

docker exec -it SQLEdge mkdir "/var/opt/mssql/backup"
docker cp ~/Desktop/AdventureWorks2022.bak SQLEdge:/var/opt/mssql/backup/

Using Azure Data Studio

Then restore

RESTORE DATABASE AdventureWorks2022 FROM DISK = '/var/opt/mssql/backup/AdventureWorks2022.bak' WITH REPLACE, RECOVERY, MOVE 'AdventureWorks2022' TO '/var/opt/mssql/data/aw2022.mdf', MOVE 'AdventureWorks2022_log'  TO '/var/opt/mssql/data/aw2022.ldf';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment