mssql-docker
mssql-docker copied to clipboard
Does not work on Mac M1
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?
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,
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'
Nice one, @rjschave. Thanks for the info!
Please add aarch64 and arm64 support (necessary if one is using docker on M1 mac).
More people are running into this issue and using azure sql edge as a workaround.
Please add support for ARM64 / Apple silicon / M1 to MS SQL Server docker image.
👍 '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.
M1 support is needed urgently
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.
If there is no support for MSSQL we as a company will look into other solutions! To me thats a must have.
M1 support is needed urgently
M1 support is needed urgently
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.
M1 support is needed urgently
M1 support is needed urgently
M1 support is needed urgently
M1 support is needed urgently
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.
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.
M1 support is needed urgently!!!
M1 support is needed urgently!!!
Please leave thumbs up on the relevant messages instead of polluting the thread and not bringing anything.
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).
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.
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
M1 support is needed urgently
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 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
@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.
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.
@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!!