microsoft / mssql-docker

Official Microsoft repository for SQL Server in Docker resources
MIT License
1.74k stars 760 forks source link

Does not work on Mac M1 #734

Closed meyntony closed 1 year ago

meyntony commented 2 years ago
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=<YourStrongPassw0rd#4b4b5c9e-cec8-49c1-8b50-a59e47ba4c63>" -p 56038:1433 --name umbracocloud-local-dev-sql-Modular-56038 -h Modular.umbracocloud-local-dev-sql -d mcr.microsoft.com/mssql/server:2019-latest
docker exec -it umbracocloud-local-dev-sql-Modular-56038 /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "<YourStrongPassw0rd#4b4b5c9e-cec8-49c1-8b50-a59e47ba4c63>" -Q "CREATE DATABASE LocalDevUmbracoCloudModular"

The above code works fine on Windows, Ubuntu, Mac with Intel Chip, but not on Mac with the M1 chip.

Is this a known issue?

iOvergaard commented 2 years ago

I am trying out the commands that @meyntony wrote on an M1 Pro (arm64) processor and getting the following warning when spinning up the container:

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

I figure this explains why it would or could give problems.

A possible workaround, following this guide, suggests to use the image mcr.microsoft.com/azure-sql-edge instead which seemingly works on the arm64 arch pretty much by changing the image name and adding some Linux capabilities:

docker run --cap-add SYS_PTRACE -e 'ACCEPT_EULA=1' -e 'MSSQL_SA_PASSWORD=P@ssw0rd' -p 1433:1433 --name sqledge -d mcr.microsoft.com/azure-sql-edge

In terms of running the sqlcmd command afterwards, I am not sure how to do that as it looks like the command resides in another place and I have not looked much into it.

Even so, I am able to connect to the database server using Azure Data Studio (which works on Apple Silicon even though it's not officially supported) and create new databases.

rjschave commented 2 years ago

@iOvergaard,

The sqlcmd utility is not included in the ARM64 version of the SQL Edge container. I pulled another image that contains sqlcmd.

Retreive image w/ sqlcmd tools: docker pull mcr.microsoft.com/mssql-tools

Assuming the SQL Edge container is running on the same machine and bound to the default port of 1433, you could try something like this: docker run -it -d --platform linux/amd64 mcr.microsoft.com/mssql-tools /opt/mssql-tools/bin/sqlcmd -S host.docker.internal -U <user_name> -P '<password>' -Q 'SELECT * FROM a_table'

iOvergaard commented 2 years ago

Nice one, @rjschave. Thanks for the info!

roboticflamingo commented 2 years ago

Please add aarch64 and arm64 support (necessary if one is using docker on M1 mac).

sshquack commented 2 years ago

More people are running into this issue and using azure sql edge as a workaround.

Screenshot 000072@2x

Please add support for ARM64 / Apple silicon / M1 to MS SQL Server docker image.

eriklumme commented 2 years ago

👍 'ed this issue. I'm using Azure SQL Edge as a workaround, but the lack of CLR support is an issue, as the database I'm working with uses the FORMAT function heavily.

xahanix commented 2 years ago

M1 support is needed urgently

bobbeli commented 2 years ago

Since Azure SQL Edge does not support all the features of SQL Server its not an appropriate alternative for everyone. I would highly appreciate if Microsoft would support the M1 soon.

Justinio99 commented 2 years ago

If there is no support for MSSQL we as a company will look into other solutions! To me thats a must have.

mathibla commented 2 years ago

M1 support is needed urgently

Dihenry06 commented 2 years ago

M1 support is needed urgently

claresloggett commented 2 years ago

This is pretty major, we've just had our dev machines upgraded, and the new Macs mean we are now on M1 chips and cannot develop with MS SQL. I'd assume it will become an issue for more and more people as the old machines age out.

coolwuu commented 2 years ago

M1 support is needed urgently

coolwuu commented 2 years ago

M1 support is needed urgently

louisektw commented 2 years ago

M1 support is needed urgently

sirmahyar commented 2 years ago

M1 support is needed urgently

tracker1 commented 2 years ago

I would suggest reducing the "me too" comments and simply thumbs up on the primary post at the top.

I'm not working for MS, but would be surprised if this sees any attention in the near term. Mostly because M1 isn't really a server target for MS SQL Server. And the "edge" version is where any effort for ARM is going. You may be best off requesting better feature parity for that release.

I would also suggest considering PostgreSQL as well, depending on how difficult porting would be for you, but you may run in to similar issues with specific use cases locally. Having gone through several painful database platform migrations in the early 00's it is emphatically not fun and I don't recommend it.

An alternative might be a cloud hosted instance with each dev working on a separate database or sets of databases... not as clean as a fresh docker image, but at least something to move forward. Again, depends on your need/load.

SuperFola commented 2 years ago

There is the solution of running the container inside a VM, such as colima which can interface with docker pretty easily. However, even if the container spins to life for me, is reachable and all, liquibase will take a very long time to send the changelog and SQL commands to the container. What takes a few minutes (even seconds) on a Mac Intel takes forever with colima + Mac M1 somehow. If it spins to life, it will (most of the time for me) crash before sending everything, saying that the change log lock couldn't be acquired. Still investigating.

For those wanting to try this out, I'm using colima start --arch amd --cpu 5 -memory 5 --dns 8.8.8.8 on a Mac M1 Pro. If you have any certificate problem when trying to pull images, this helped me getting it to work: https://stackoverflow.com/a/55260438/13157652.

yk-jemmic commented 2 years ago

M1 support is needed urgently!!!

sadbuttrue1 commented 2 years ago

M1 support is needed urgently!!!

SuperFola commented 2 years ago

Please leave thumbs up on the relevant messages instead of polluting the thread and not bringing anything.

Meligy commented 2 years ago

Sorry for spamming, I just want to say that while workaround like colima exist, they have issues. Some are obvious (the degradation of performance emulating x86), some are not so (the emulation, being a hack it can break eventually, like https://github.com/abiosoft/colima/issues/288).

JohannesHoppe commented 2 years ago

Bumping this for visibility.

We pay a ton of money for our Azure and I expect Microsoft to fix a problem on time, only once please. But as usual, disappointment all the way.

JohannesHoppe commented 2 years ago

FYI. You can find some workarounds here, but the whole situation is still just pathetic: https://github.com/microsoft/mssql-docker/issues/668#issuecomment-1149840353 or here https://github.com/microsoft/mssql-docker/issues/668#issuecomment-1096711248

teodoramiteva commented 2 years ago

M1 support is needed urgently

SuperFola commented 2 years ago

M1 support is needed urgently

There is a solution, see https://github.com/microsoft/mssql-docker/issues/734#issuecomment-1120894782.

I got it to work correctly by starting only sqlserver inside Colima, and all of my other containers inside Docker Desktop, just by switching the current docker context, pretty easy to do.

roman-levenets commented 2 years ago

@SuperFola could you please share with the example of switching Docker contexts? I want to run my docker compose with SQL server under Colima and other Docker instances as usual under ARM virtualization. Thank you

darrinholst commented 2 years ago

@SuperFola could you please share with the example of switching Docker contexts? I want to run my docker compose with SQL server under Colima and other Docker instances as usual under ARM virtualization. Thank you

DOCKER_CONTEXT=colima docker compose up

It does work, but it's miserably slow. I switched to using an ec2 instance as a remote docker host.

SuperFola commented 2 years ago

It works well, but there only need to be sqlserver inside Colima. I launch Colima, it creates and switch to the docker context it created.

docker context use colima and voilà, every docker command is "in" Colima. Then launch everything else in docker desktop with the profile default. That's all.

If you any certificate problem you will need to play with the certificates inside Colima, that's not hard and there are documentation about it.

JohannesHoppe commented 2 years ago

@meyntony we shouldn't close this. This issue is not resolved at all. The emulation with colima is an unbelievable slow workaround. We are all working for paying customers (I swear, I would never consider SQL server for my own projects) and Microsoft should provide a real solution!!

JohannesHoppe commented 2 years ago

@meyntony edit: Fixed my harsh wording...

meyntony commented 2 years ago

Closed by mistake while I was trying to unsubscribe. Sorry.

SuperFola commented 2 years ago

The emulation with colima is an unbelievable slow workaround.

I've been using this for a while on my M1 Pro and don't have any slowness problem, you must be doing something wrong. Only SQLServer needs to run inside colima, not your other containers.

JohannesHoppe commented 2 years ago

If you're using a lot of T-SQL with a lot of data, it's definitely very slow. I'm glad it works for you on your machine with your data, but it doesn't change the fact that emulating a different processor architecture is slow as hell.

ramonesteban78 commented 2 years ago

M1 support is needed urgently

Dzivo commented 2 years ago

M1 support is needed urgently

Joel-Duff commented 2 years ago

M1 support is needed urgently

grishick commented 2 years ago

+1 really need this for local development

prajal55 commented 2 years ago

+1 need this

dashkodo commented 2 years ago

+1, sql server edge is too limited

thisisthekap commented 2 years ago

Docker is going to add support without QEMU: https://github.com/docker/roadmap/issues/384

aldo1400 commented 2 years ago

M1 support is needed urgently

MrBogomips commented 2 years ago

Azure Sql Edge is not a viable option!

Lacking of fundamental features and a lot of issues with tooling make it a toy.

Please add support for Apple M1 silicon.

theramzay commented 2 years ago

2+ years past since WWDC 2020. We're all need support for Apple silicon.

jordantshaw commented 2 years ago

How has this not been fixed yet. This is an absolute must for local development

jordantshaw commented 2 years ago

The emulation with colima is an unbelievable slow workaround.

I've been using this for a while on my M1 Pro and don't have any slowness problem, you must be doing something wrong. Only SQLServer needs to run inside colima, not your other containers.

Im also experiencing extreme slowness with this colima solution. Anyway you can outline in more detail what you're doing to avoid that? Specifically using docker compose?

konstantinos-kafkas-cko commented 2 years ago

Please add support for Apple M1 silicon.

ZachBourque commented 2 years ago

M1 support needed urgently please :)

botanozdemir commented 2 years ago

THIS IS A BLOCKER ISSUE. M1 SUPPORT NEEDED URGENTLY! COLIMA AND AZURE EDGE NOT VIABLE SOLUTIONS.

tracker1 commented 2 years ago

@botanozdemir Yelling will not draw attention any faster...