Unable to download SQL Server on M1 Mac [closed] - sql-server

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 11 days ago.
Improve this question
I have been trying to download SQL Server on my Mac with an Apple Chip. I've been following the steps that include downloading docker and entering code into my terminal to set up the images and containers within docker. However, when I try and type in this code:
docker run --name SQLServer -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=12345OHdf%e' -e 'MSSQL_PID=Express’ -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-latest
I get the following response in terminal:
WARNING: The requested image's platform (linux/amd64) does not match
the detected host platform (linux/arm64/v8) and no specific platform
was requested
a1c6173553fc3ae53d28cc4c8bef452fdd322bf1ab2074124803c2275a97e587
I was wondering if anybody would be able to help me in fixing this problem

Using the azure sql edge docker image and installing mssql tool separately worked for us.
This is the Dockerfile
FROM mcr.microsoft.com/azure-sql-edge:latest
EXPOSE 1433
COPY ./database/schema.sql /database/schema.sql
ENV SA_PASSWORD "MyP#w0rd"
ENV SQLCMDPASSWORD "MyP#w0rd"
ENV ACCEPT_EULA "Y"
RUN (mkdir -p /opt/mssql-tools/bin && cd /opt/mssql-tools/bin && wget https://github.com/microsoft/go-sqlcmd/releases/download/v0.8.0/sqlcmd-v0.8.0-linux-arm64.tar.bz2 \
&& bzip2 -d sqlcmd-v0.8.0-linux-arm64.tar.bz2 && tar -xvf sqlcmd-v0.8.0-linux-arm64.tar && chmod 755 sqlcmd)
RUN /opt/mssql/bin/sqlservr & sleep 20 && \
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -d master \
-Q "create database testdb;" && \
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -d master -i /database/schema.sql
CMD /opt/mssql/bin/sqlservr

From the docker docs:
"Not all images are available for ARM64 architecture. You can add
--platform linux/amd64 to run an Intel image under emulation. In particular, the mysql image is not available for ARM64. You can work
around this issue by using a mariadb image."

A bit late to the party but here's a workaround for this using an open source tool called Lima and Rosetta as the VM: https://dev.to/srburnham/forget-azure-sql-edge-on-a-m1-mac-run-full-blown-sql-server-linux-instead-a-how-to-6d2. Saves you from having to resort to the cutdown edge version.

I have followed the tutorial on the website but I can't connect azure data studio to the SQL Server instance ... while he is running
#Aaron Bertrand
I finally use Azure Sql Database instead of SSMS

Related

MSSQL via docker on Mac Apple M1 chip | not able to install

I am using macOS Monterey with Apple M1 chipset and trying to install MS SQL via Docker while following this article: https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-ver15&pivots=cs1-bash
once I am trying to run the server then getting this issue
▶ docker run -d --name example_sql_server -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=test#123' -p 1433:1433 mcr.microsoft.com/mssql/server:2019-latest
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
fcb5825617f24ab22a9e7c7b4707f7084ab3945e541c2c12a2e03285fa2baaae
While going through Microsoft mcr documentation then I am not able to find any 'linux/arm64/v8' compatible version, can someone please help me here to install SQL server on my machine.

How do you assign IP to WSL2 and/or Docker container so it can be accessed from local network

I have a host machine (192.168.1.5) which is running Windows 10 with WSL2 (winver 2004 OS build 19041.329).
I've moved my Docker script over to WSL2 (runs fine on a Linux vm) and I have that running fine. I just can not access mssql from either the host machine or anything on my local network.
This is my create script
sudo docker run -d \
-p 7000:1433 \
-e SA_PASSWORD=<hidden> \
-e ACCEPT_EULA=Y \
-e MSSQL_PID=Developer \
-v /home/docker/mssql/backup:/data \
-v /home/docker/mssql:/var/opt/mssql \
-e attach_dbs="[{'dbName':'THEDB','dbFiles':['/data/thedb.mdf','/data/thedb_log. ldf']}]" \
--name sql microsoft/mssql-server-linux:latest \
It works and I can connect into it and query etc from within the image.
I have tried various --network options such as host and bridge.
I'm unsure if this is a docker issue or a WSL2 issue, although I've done a WSL2 sudo apt update fine. I think it uses nat to access the Internet for that. It can't ping any machines on the network. (from WSL2)
How do I configure a public IP (ipv4) such that I can access the mssql database remotely.
Turns out I was not doing anything wrong. The way to access the WSL2 based docker image is by using the host IP address and the port (in my case I had changed the port to 7000).
A few weeks after I posted my question, an update to WSL2 and/or Docker seemed to fix my networking issues, so I can only assume there was a temporary bug being experienced. This issue resolved itself on the two machines I was experiencing the networking issues.

Docker Container exit immediately after running

I'm a Docker newbie and tried to resolve the issue after checking similar SO questions without success. So please don't mark it as a duplicate .
Issue :
The container always exits immediately after its created and running.
I have tried to run the mssql instance using command
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Technocrat123’ -p 1433:1433 -d microsoft/mssql-server-linux
when trying as similar SO link link
$ docker run -t -d --name microsoft/mssql-server-linux 0adcdf822722
got the following error ,
Unable to find image '0adcdf822722:latest' locally
docker: Error response from daemon: repository 0adcdf822722 not found: does not exist or no pull access.
when tried to kill the process referring link1
Kill: illegal process id: PID
I'm using a mac machine. Thanks in advance.
Edit :
After running the log after run command like
docker logs 0adcdf822722
it shows
This is an evaluation version. There are [160] days left in the evaluation period.
The SQL Server End-User License Agreement (EULA) must be accepted before SQL
Server can start. The license terms for this product can be downloaded from
http://go.microsoft.com/fwlink/?LinkId=746388.
You can accept the EULA by specifying the --accept-eula command line option,
setting the ACCEPT_EULA environment variable, or using the mssql-conf tool.
But already in the run command I have set 'ACCEPT_EULA=Y'.
Your password (such as Technocrat123) doesn't meet the complexity requirements. So try adding a non-alphanumeric characters such as exclamation point (!). Secondly, use double quotes instead of single.
To check for errors, run: docker logs ID (where ID is container ID from docker ps).
This worked for me:
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Sprpwd1234" --name sql_server_dev -p 1433:1433 -d store/microsoft/mssql-server-linux:2017-GA
Using (") instead of ('). Running Docker on Windows 10.
There is a typo in the command you are running:
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Technocrat123’ -p 1433:1433 -d microsoft/mssql-server-linux
'Technocrat123’ should be 'Technocrat123'. The typo is in the end: ’ vs '.
The correct command is:
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Technocrat123' -p 1433:1433 -d microsoft/mssql-server-linux
I was running Docker on Mac and trying to install sql-server. Initially, I was pasting the command provided here - https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker changing password. Then I would try to run the docker image. This gave me the said error "This is an evaluation version.....". I did an additional step, after running the command on the above link. I ran it again as docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=Very_StrongPassword' -p 1401:1433 microsoft/mssql-server-linux:2017-latest. This kicked off installation of sql-server. This installation takes around 20-30 mins. Then the docker image is ready to use.

Docker Keep Exiting (Deploying MS SQL on MAC osx)

I'm trying to deploy an MS SQL server on my MAC. There are several alternatives for that.
Here, I'm using docker: I've checked the MS-SQL website, and I executed this code:
docker run -e
'ACCEPT_EULA=Y'
-e 'SA_PASSWORD=<YourStrong!Passw0rd>' -p 1433:1433
-d microsoft/mssql-server-linux
However, The container keeps stopping by itself.
Did I miss something here?
The docker Version I'm using:
Version 1.13.0 (15072)
I had a similar problem. I finally realized the issue was that I was using a dummy password for local dev that didn't adhere to SQL Server's password policy. I used a more complex password and that fixed it up.
I faced this issue recently on Windows. Changing the ' quotes to " fixed the issue.
If you are using MacOS Ventura and/or using a Mac with M1/M2 (Apple Silicon) chip, you will need to enable the Rosetta Emulation to get this to work.
Go to Docker > Settings > Features in development and enable the option 'Use Rosetta for x86/amd64' emulation on Apple Silicon' and restart Docker.
Also, make sure the password obeys the Password Policy set by Microsoft and create a strong password.
Delete the container and re-run the docker run command. An example is below:
docker run -d -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Ithink%Th5r5f0re$Iam' --name sql_server --platform linux/amd64 -p 1433:1433 mcr.microsoft.com/mssql/server:2022-latest
This should get you run the container without the Exited(1) error.
This link explains the details:
https://devblogs.microsoft.com/azure-sql/development-with-sql-in-containers-on-macos/
When running this on Mac you need to bump up your Docker for Mac's RAM. SQL Server needs minimum 4GB RAM, Docker for Mac by default only allocates about 1-2GB for all containers.
To increase Docker for Mac's RAM:
Open Docker for Mac's preferences
Click "Resources"
Move the RAM slider up, in my case I moved it to 6GB (4GB for SQL Server and 2GB for everything else)
You also need to allocate 4GB to the container when starting it up:
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=<YourStrong!Passw0rd>' --memory=4096M -p 1433:1433 -d microsoft/mssql-server-linux
To confirm you memory limits were applied run: docker stats. The MEM USAGE / LIMIT column for the SQL Server container should have output similar to: 536.7MiB / 4GiB
The other thing to watch out for on Mac is that you cannot mount volumes this will cause issues.

How to import .bacpac into docker Sqlserver?

I installed Sqlserver on my Mac in a docker container, following the instructions from this article.
I run the container with Kitematic and managed to connect to the server using Navicat Essentials for SQl Server.
The server has four databases and I can create new ones, but, ideally, I would like to import an existing database as .bacpac.
The instructions from this answer have been of use to me in the past. Can I run something similar within the container? Or, more generally, is there a way to import a database in the container?
Hi all! We finally have a preview ready for sqlpackage that is built on dotnet core and is cross-platform! Below are the links to download from. They are evergreen links, i.e. each day a new build is uploaded. This way any checked in bug fix is available the next day. Included in the .zip file is the preview EULA.
linux
https://go.microsoft.com/fwlink/?linkid=873926
osx
https://go.microsoft.com/fwlink/?linkid=873927
windows
https://go.microsoft.com/fwlink/?linkid=873928
Release notes:
The /p:CommandTimeout parameter is hardcoded to 120
Build and deployment contributors are not supported
a. Need to move to .NET Core 2.1 where System.ComponentModel.Composition.dll is supported
b. Need to handle case-sensitive paths
SQL CLR UDT types are not supported.
a. This includes SQL Server Types SqlGeography, SqlGeometry, & SqlHierarchyId
Older .dacpac and .bacpac files that use Json serialization are not supported
Referenced .dacpacs (e.g. master.dacpac) may not resolve due to issues with case-sensitive file systems
For lack of a better method, please provide any feedback you have here on this GitHub issue.
Thanks for giving it a try and letting us know how it goes!
https://github.com/Microsoft/mssql-docker/issues/135#issuecomment-389245587
EDIT: I've made you a Docker image for this
https://hub.docker.com/r/samuelmarks/mssql-server-fts-sqlpackage-linux/
Example of setting up a container, creating a database, copying a .bacpac file over, and importing it into aforementioned database:
docker run -d -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=<YourStrong!Passw0rd>' -p 1433:1433 --name sqlfts0 samuelmarks/mssql-server-fts-sqlpackage-linux
docker exec -it sqlfts0 /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P '<YourStrong!Passw0rd>' -Q 'CREATE DATABASE MyDb0'
docker cp ~/Downloads/foo.bacpac sqlfts0:/opt/downloads/foo.bacpac
docker exec -it sqlfts0 dotnet /opt/sqlpackage/sqlpackage.dll /tsn:localhost /tu:SA /tp:'<YourStrong!Passw0rd>' /A:Import /tdn:MyDb0 /sf:foo.bacpac
It looks like Microsoft has implemented support of this on sqlpackage, with documentation!
You will have to add sqlpackage to your container.
You can download it here. (optionally, direct link to linux package here, hopefully doesn't change)
The following are instructions for running this from a windows machine -- obviously it's the bare minimum to get it working. Please change passwords, and probably put this in a docker-compose.yml for re-use.
I unzip the above package into a folder 'c:\sqlpackage' (my windows docker run doesn't allow relative paths), and then mount that into the container with the bacpac, like such:
docker run -d -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Asdf1234" -v c:\sqlpackage:/opt/sqlpackage -v c:\yourdb.bacpac:/tmp/yourdb.bacpac -p 1433:1433 --name mssql-server-example microsoft/mssql-server-linux:2017-latest
here is what a *nix user could run alternatively:
docker run -d -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Asdf1234' -v ./sqlpackage:/opt/sqlpackage -v ./yourdb.bacpac:/tmp/yourdb.bacpac -p 1433:1433 --name mssql-server-example microsoft/mssql-server-linux:2017-latest
and finally, attach to your container and run:
/opt/sqlpackage/sqlpackage /a:Import /tsn:. /tdn:targetdbname /tu:sa /tp:Asdf1234 /sf:/tmp/yourdb.bacpac
After this, you should be able to connect with SSMS to localhost, username and password as you provide them above, and see 'targetdbname'! These are mostly notes I wrote for myself but I'm sure others could use them too.
You can use free Azure Data Studio from Microsoft. Once you have it installed, install the extension "Admin Pack for SQL Server" from Microsoft. Then you can import bacpac files with ease.
This is not a supported feature with a LINUX implementation it seems.
See this link.

Resources