question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MsSqlTestcontainer with azure-sql-edge image does not start on ARM64 (Mac M1)

See original GitHub issue

I’ve tried MsSqlTestcontainer with mcr.microsoft.com/azure-sql-edge but it won’t start.

var testcontainersBuilder = new TestcontainersBuilder<MsSqlTestcontainer>()
    .WithDatabase(new MsSqlTestcontainerConfiguration()
    {
        Password = "StrongP@ssw0rd!"
    })
    .WithImage("mcr.microsoft.com/azure-sql-edge");

var testcontainer = testcontainersBuilder.Build();
testcontainer.StartAsync().Wait();

I’ve figured it out that the reason of that behavior is because sqlcmd tool is not available inside the ARM64 version of SQL Edge containers according to docker image description (https://hub.docker.com/_/microsoft-azure-sql-edge). But sqlcmd is necessary to verify that the container has started (see file: MsSqlTestcontainerConfiguration.cs):

public override IWaitForContainerOS WaitStrategy => Wait.ForUnixContainer()
    .UntilCommandIsCompleted($"/opt/mssql-tools/bin/sqlcmd -S 'localhost,{this.DefaultPort}' -U '{this.Username}' -P '{this.Password}'");

Questions:

1a) Should it be treated as an error of handling ARM64 image? or maybe 1b) Should it be treated as a different Testcontainer, something like AzureSqlEdgeTestcontainer? 2) What other alternative of WayStrategy can be used in this particular case?

Currently it is the only docker image that runs on M1 macs from the hole MS SQL Server family. Please help.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

5reactions
cagrincommented, Mar 31, 2022

BTW, I was able to make custom Azure SQL Edge image, that contains simple sqlcmd tool on ARM64. See my repo for more details: https://github.com/cagrin/azure-sql-edge-arm64

With cagrin/azure-sql-edge-arm64 image it is now possible to simple use MsSqlTestcontainer on ARM64 (M1 Mac).

var testcontainersBuilder = new TestcontainersBuilder<MsSqlTestcontainer>()
    .WithDatabase(new MsSqlTestcontainerConfiguration()
    {
        Password = "StrongP@ssw0rd!"
    })
    .WithImage("cagrin/azure-sql-edge-arm64");
0reactions
Trinitioncommented, Mar 31, 2022

@HofmeisterAn you are right. That’s how new I was! I did manage to add a little custom code to get Azure SQL Edge working with testcontainers-java, but the whole container-wait mechanism is different there, so it’s a different solution that what’s presented here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Does not work on Mac M1 · Issue #734
I pulled another image that contains sqlcmd. Retreive image w/ sqlcmd tools: docker pull mcr.microsoft.com/mssql-tools. Assuming the SQL Edge ...
Read more >
Azure SQL Edge on Mac M1 using Docker
I tried to run Azure SQL Edge using Docker on M1 Mac, but it keeps on saying "Failed to load /var/opt/mssql/mssql.conf ini file...
Read more >
Sql server not running inside docker in m1 processor
I have used azure-sql-edge it is working with this ... docker run -e "ACCEPT_EULA=1" -e "MSSQL_SA_PASSWORD=MyPass@word" -e ...
Read more >
Running Azure SQL Edge on Docker on macOS M1
After the installation is done, open Docker Desktop. You'll be welcomed by a home page that shows no containers running. Docker Desktop. Running ......
Read more >
Docker Express: Running a Local SQL Server on Your M1 ...
This database has been Dockerised and ported to ARM64 and thus can run on Docker for M1 on your Mac. TL;RD; This is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found