Saber Alex
Saber Alex

Reputation: 1723

Docker Keep Exiting (Deploying MS SQL on MAC osx)

I'm trying to deploy an MS SQL server on my MAC. There are several alternatives for that.

Here, I'm using docker: I've checked the MS-SQL website, and I executed this code:

docker run -e 
'ACCEPT_EULA=Y' 
-e 'SA_PASSWORD=<YourStrong!Passw0rd>' -p 1433:1433 
-d microsoft/mssql-server-linux

However, The container keeps stopping by itself. Did I miss something here?

enter image description here

The docker Version I'm using: Version 1.13.0 (15072)

Upvotes: 14

Views: 8931

Answers (5)

Michel Hua
Michel Hua

Reputation: 1777

You can also use ARM based image with docker pull mcr.microsoft.com/azure-sql-edge.

Upvotes: 0

Ram Iyer
Ram Iyer

Reputation: 1679

If you are using MacOS Ventura and/or using a Mac with M1/M2 (Apple Silicon) chip, you will need to enable the Rosetta Emulation to get this to work.

Go to Docker > Settings > Features in development and enable the option 'Use Rosetta for x86/amd64' emulation on Apple Silicon' and restart Docker.

Also, make sure the password obeys the Password Policy set by Microsoft and create a strong password.

Delete the container and re-run the docker run command. An example is below:

docker run -d -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Ithink%Th5r5f0re$Iam' --name sql_server --platform linux/amd64 -p 1433:1433 mcr.microsoft.com/mssql/server:2022-latest

This should get you run the container without the Exited(1) error.

This link explains the details:

https://devblogs.microsoft.com/azure-sql/development-with-sql-in-containers-on-macos/

Upvotes: 3

Mike Pennington
Mike Pennington

Reputation: 676

I had a similar problem. I finally realized the issue was that I was using a dummy password for local dev that didn't adhere to SQL Server's password policy. I used a more complex password and that fixed it up.

Upvotes: 8

8bitme
8bitme

Reputation: 947

When running this on Mac you need to bump up your Docker for Mac's RAM. SQL Server needs minimum 4GB RAM, Docker for Mac by default only allocates about 1-2GB for all containers.

To increase Docker for Mac's RAM:

  • Open Docker for Mac's preferences
  • Click "Resources"
  • Move the RAM slider up, in my case I moved it to 6GB (4GB for SQL Server and 2GB for everything else)

You also need to allocate 4GB to the container when starting it up:

docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=<YourStrong!Passw0rd>' --memory=4096M -p 1433:1433 -d microsoft/mssql-server-linux

To confirm you memory limits were applied run: docker stats. The MEM USAGE / LIMIT column for the SQL Server container should have output similar to: 536.7MiB / 4GiB

The other thing to watch out for on Mac is that you cannot mount volumes this will cause issues.

Upvotes: 0

betelgeuce
betelgeuce

Reputation: 837

I faced this issue recently on Windows. Changing the ' quotes to " fixed the issue.

Upvotes: 2

Related Questions