Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sql server not running inside docker in m1 processor

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
like image 569
Prashant Gupta Avatar asked Dec 05 '25 17:12

Prashant Gupta


2 Answers

I have used azure-sql-edge it is working with this

You 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

like image 93
Prashant Gupta Avatar answered Dec 08 '25 10:12

Prashant Gupta


Answer updated in 2023, Monday 20th.

Best option: Use Docker's Rosetta emulation mode

  • Install Ventura, the newest MacOS
  • Upgrade Docker to latest
  • Docker Settings > General: [X] Use virtualization framework and
  • Docker Settings > Features in Development: [X] Use Rosetta...
  • Use platform: linux/amd64 in Docker-compose or --platform linux/amd6 when running containers from command line

Link to instructions: https://levelup.gitconnected.com/docker-on-apple-silicon-mac-how-to-run-x86-containers-with-rosetta-2-4a679913a0d5

like image 32
Capuchin Avatar answered Dec 08 '25 12:12

Capuchin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!