14

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)

4
  • 14
    can you check what the logs say wth docker logs -f <container_id>? Commented Jan 20, 2017 at 13:59
  • 4
    Ahh, I see!! It's because of the memory!! Thanks for this!!! Commented Jan 20, 2017 at 14:00
  • 5
    @SaberAlex I assume you figured it out yourself. But set available RAM in to 4096MB. SQL Server requires atleast 3.25GB in order to run at all. Docker should restart when clicking 'Apply'. See: hub.docker.com/r/microsoft/mssql-server-linux Commented Jan 20, 2017 at 14:04
  • 2
    I also faced same situation but on windows. But when I removed quotes from docker run command it worked for me, please note that I have updated password. I run this command without starting and ending double quotes. "docker run -e ACCEPT_EULA=Y -e SA_PASSWORD=Test@1234 -p 1433:1433 -d microsoft/mssql-server-linux" Commented May 8, 2017 at 9:29

5 Answers 5

8

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.

Sign up to request clarification or add additional context in comments.

1 Comment

That was the issue. Kinda stupid that it just exits, but I guess it makes some sense.
3

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/

Comments

2

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

Comments

0

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.

1 Comment

The latest version of this now says At least 2GB of RAM (3.25 GB prior to 2017-CU2) , see hub.docker.com/_/microsoft-mssql-server
0

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.