I am trying to make sql server run inside the docker in the mac m1 processor. Every time I am getting
exit code 1
Processor : Arm(mac m1)
docker image tried with : mcr.microsoft.com/azure-sql-edge:1.0.6 and mcr.microsoft.com/azure-sql-edge:latest
docker-compose.yml file
version: "3.1"
services:
mssql:
image: mcr.microsoft.com/azure-sql-edge:1.0.6
container_name: mssql
volumes:
- events_mssql:/var/opt/mssql
- ./setup.sql:/usr/config/setup.sql
ports:
- 1433:1433
environment:
- ACCEPT_EULA=Y
- MSSQL_SA_PASSWORD=Passw@rd
- MSSQL_PID=Developer
- MSSQL_DB=events_service
- MSSQL_USER=SA
- MSSQL_PASSWORD=Passw@rd
- MSSQL_DB_AUDIT_LOG=events_service_audit_log
volumes:
events_mssql:
setup.sql file
CREATE DATABASE $(MSSQL_DB);
CREATE DATABASE $(MSSQL_DB_AUDIT_LOG);
GO
USE $(MSSQL_DB);
GO
CREATE LOGIN $(MSSQL_USER) WITH PASSWORD = '$(MSSQL_PASSWORD)';
GO
CREATE USER $(MSSQL_USER) FOR LOGIN $(MSSQL_USER);
GO
ALTER SERVER ROLE sysadmin ADD MEMBER [$(MSSQL_USER)];
GO
ERROR:
docker-compose up
[+] Running 1/0
⠿ Container mssql Created 0.0s
Attaching to mssql
mssql | Azure SQL Edge will run as non-root by default.
mssql | This container is running as user mssql.
mssql | To learn more visit https://go.microsoft.com/fwlink/?linkid=2140520.
mssql | /opt/mssql/bin/sqlservr: Invalid mapping of address 0x40092f5000 in reserved address space below 0x400000000000. Possible causes:
mssql | 1) the process (itself, or via a wrapper) starts-up its own running environment sets the stack size limit to unlimited via syscall setrlimit(2);
mssql | 2) the process (itself, or via a wrapper) adjusts its own execution domain and flag the system its legacy personality via syscall personality(2);
mssql | 3) sysadmin deliberately sets the system to run on legacy VA layout mode by adjusting a sysctl knob vm.legacy_va_layout.
mssql |
mssql exited with code 1
3
Answers
I have used
azure-sql-edge
it is working with thisYou can use the command to bring up the docker
docker run -e "ACCEPT_EULA=1" -e "MSSQL_SA_PASSWORD=MyPass@word" -e "MSSQL_PID=Developer" -e "MSSQL_USER=SA" -p 1433:1433 -d --name=sql mcr.microsoft.com/azure-sql-edge
As of the time of writing this response, there is a github issue on this; though it was recently closed in favour of following the topic in another issue.
Answer updated in 2023, Monday 20th.
Best option: Use Docker’s Rosetta emulation mode
[X] Use virtualization framework
and[X] Use Rosetta...
platform: linux/amd64
in Docker-compose or--platform linux/amd6
when running containers from command lineLink to instructions: https://levelup.gitconnected.com/docker-on-apple-silicon-mac-how-to-run-x86-containers-with-rosetta-2-4a679913a0d5