mssql-docker icon indicating copy to clipboard operation
mssql-docker copied to clipboard

Does not work on Mac M1

Open meyntony opened this issue 2 years ago • 51 comments

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?

meyntony avatar Jan 04 '22 14:01 meyntony

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.

iOvergaard avatar Jan 05 '22 13:01 iOvergaard

@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'

rjschave avatar Jan 05 '22 15:01 rjschave

Nice one, @rjschave. Thanks for the info!

iOvergaard avatar Jan 06 '22 13:01 iOvergaard

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

roboticflamingo avatar Feb 01 '22 18:02 roboticflamingo

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.

sshquack avatar Feb 11 '22 04:02 sshquack

👍 '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.

eriklumme avatar Feb 14 '22 08:02 eriklumme

M1 support is needed urgently

xahanix avatar Mar 14 '22 13:03 xahanix

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.

bobbeli avatar Mar 15 '22 07:03 bobbeli

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

Justinio99 avatar Mar 15 '22 19:03 Justinio99

M1 support is needed urgently

mathibla avatar Mar 15 '22 19:03 mathibla

M1 support is needed urgently

Dihenry06 avatar Mar 21 '22 18:03 Dihenry06

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.

claresloggett avatar Mar 31 '22 00:03 claresloggett

M1 support is needed urgently

coolwuu avatar Apr 04 '22 03:04 coolwuu

M1 support is needed urgently

coolwuu avatar Apr 04 '22 03:04 coolwuu

M1 support is needed urgently

louisektw avatar Apr 07 '22 08:04 louisektw

M1 support is needed urgently

sirmahyar avatar Apr 10 '22 15:04 sirmahyar

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.

tracker1 avatar Apr 11 '22 12:04 tracker1

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.

SuperFola avatar May 09 '22 09:05 SuperFola

M1 support is needed urgently!!!

yk-jemmic avatar May 12 '22 08:05 yk-jemmic

M1 support is needed urgently!!!

sadbuttrue1 avatar May 17 '22 05:05 sadbuttrue1

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

SuperFola avatar May 17 '22 05:05 SuperFola

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).

Meligy avatar May 18 '22 05:05 Meligy

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 avatar Jun 08 '22 08:06 JohannesHoppe

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

JohannesHoppe avatar Jun 08 '22 19:06 JohannesHoppe

M1 support is needed urgently

teodoramiteva avatar Jun 17 '22 13:06 teodoramiteva

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.

SuperFola avatar Jun 17 '22 14:06 SuperFola

@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

roman-levenets avatar Jul 05 '22 17:07 roman-levenets

@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.

darrinholst avatar Jul 05 '22 18:07 darrinholst

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.

SuperFola avatar Jul 05 '22 18:07 SuperFola

@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 avatar Jul 06 '22 06:07 JohannesHoppe