justin2004 / mssql_server_tiny

A Slightly Liberated Microsoft SQL Server Docker image
67 stars 22 forks source link

Will it work with SQL Server 2019? #4

Open ollie10 opened 3 years ago

ollie10 commented 3 years ago

Hello, just a quick question, did you try or have you planned to do the same with SQl Server 2019?? It would be great if it works anyway!

Thanks!

justin2004 commented 3 years ago

i just made a branch. it built with 2019. i was able to create tables, run queries, etc.

i am now just trying it on a VM with less than 2 GB of memory.

ollie10 commented 3 years ago

Hi, I just tried with no luck, I think it doesn't work, i tried both on windows and Linux

My Dockerfile:

FROM debian:stretch-slim AS build0
WORKDIR /root/

RUN apt-get update && apt-get install -y binutils gcc

ADD https://raw.githubusercontent.com/justin2004/mssql_server_tiny/master/wrapper.c /root/
RUN gcc -shared  -ldl -fPIC -o wrapper.so wrapper.c

FROM mcr.microsoft.com/mssql/server:2019-latest
COPY --from=build0 /root/wrapper.so /root/

CMD LD_PRELOAD=/root/wrapper.so /opt/mssql/bin/sqlservr

My commands:

sudo docker build -t sql2019 .
sudo docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 -t sql2019

Result:

SQL Server 2019 will run as non-root by default.
This container is running as user mssql.
To learn more visit https://go.microsoft.com/fwlink/?linkid=2099216.
sqlservr: This program requires a machine with at least 2000 megabytes of memory.
/opt/mssql/bin/sqlservr: This program requires a machine with at least 2000 megabytes of memory.

The wrapper.c file is correcly downloaded compiled and copied in the image

No problem if I use 2017 Image, I,m trying with a Docker host with 1Gb of RAM

justin2004 commented 3 years ago

i got the same result.

hmm. that probably means they've changed how they look for physical memory... let the arms race begin.

gersur commented 1 year ago

https://www.dbi-services.com/blog/running-sql-server-on-the-oracle-free-tier/

FROM oraclelinux:7-slim AS build0
WORKDIR /root
RUN yum update -y && yum install -y binutils gcc
ADD wrapper.c /root/
RUN gcc -shared  -ldl -fPIC -o wrapper.so wrapper.c
FROM mcr.microsoft.com/mssql/rhel/server:2019-latest
COPY --from=build0 /root/wrapper.so /root/
ADD wrapper.c /root/
USER root
RUN echo "/root/wrapper.so" > /etc/ld.so.preload
USER mssql

I tried this on 1gb instance, it can run, but not stable. Basically useless Might useful when cloud provider gives 2gb, but sql server still detect less that 2gb

justin2004 commented 1 year ago

I tried this on 1gb instance

how much swap space did you give the machine?

if you have a small amount of RAM you need to compensate for it with more swap space.

gersur commented 1 year ago

how much swap space did you give the machine?

4gb image But sql server always crash, it's like the swap barely used

I use Google Cloud Compute Engine Always Free, e2-micro, maybe this instance just can't handle SQL Server. Login through ssh need to wait ~10 sec


Then I use Alibaba ECS with 2gb ram image But in htop only shows 1.78gb, docker sql server from Microsoft won't start. Then I tried from the link above, and it works

ollie10 commented 1 year ago

If I may suggest, just give up. I did days of testing and there was no way to make it work.

My suggest is to use a service like Racknerd, they have super cheap VPS that fully support SQL plus more other service. Using it since then, never came back.

This will make it: https://lowendbox.com/blog/2-usd-vps-cheap-vps-under-2-month/ 20.98$ a year

If you need something more I suggest the 3.5 Gb RAM for less than 30$ a year: https://lowendbox.com/blog/racknerd-new-exclusive-low-end-box-offers-1-5gb-kvm-vps-from-16-55-year-in-los-angeles/

In the case you absolutely want something free I suggest to use another database engine in the cloud, here you have few: https://free-for.dev/#/?id=dbaas

Bit.io: offers 3 Postgres DB of 3 GB each for free Planetscale: Offers one MySQL of 5 GB for free

You are plenty of choice Best regards