Sign inSign up

jrichardsz/sql-server-enhanced

By jrichardsz

•Updated almost 2 years ago

A minimal enhancement of the official https://hub.docker.com/_/microsoft-mssql-server

Image
Databases & storage
0

1.6K

jrichardsz/sql-server-enhanced repository overview

⁠SQL Server - Enhanced

A minimal enhancement of the official https://hub.docker.com/_/microsoft-mssql-server⁠ because it lacks of some features

⁠Source code and issues

⁠Dockerhub

⁠Missing features in the official image

Featuredescription
/docker-entrypoint-initdb.dAlmost all the databases ported to docker offer this feature to allow the user mount a volume with sql scripts to be executed at the startup. Feature was required but the owners close⁠ it T_T
HealtcheckThere is not an official health check and the proposed⁠ script just iterates 60 times XD

⁠Notes

⁠Download

docker pull jrichardsz/sql-server-enhanced:ubuntu-22.04-sql.2022.rtm-cu15-1.0.3

⁠Run

services:
 sql-server-enhanced:
    image: jrichardsz/sql-server-enhanced:ubuntu-22.04-sql.2022.rtm-cu15-1.0.3
    container_name: sql-server-enhanced
    shm_size: 1g
    ports:
     - "1433:1433"
    environment:
      ACCEPT_EULA: 1
      MSSQL_PID: Developer
      MSSQL_USER: sa
      MSSQL_SA_PASSWORD: 70quasWNl*o#nu4U
      TZ: America/Lima
    volumes:
      - ./scripts:/docker-entrypoint-initdb.d
    healthcheck:
      test: cat /var/log/docker/sqlserver_db_init.log | grep [db_init_completed]
      interval: 10s
      timeout: 3s
      retries: 10
      start_period: 10s 

Set your own password

⁠IDE

And use these parameters to connect from your favourite ide:

⁠Docker image tags

tagoperative systemsql server versionEdition
ubuntu-22.04-sql.2022.rtm-cu15-1.0.3Ubuntu 22.04.5 LTSMicrosoft SQL Server 2022 (RTM-CU15-GDR) (KB5046059) - 16.0.4150.1 (X64)Developer Edition (64-bit)
ubuntu-22.04-sql.2022.rtm-cu15-1.0.2Ubuntu 22.04.5 LTSMicrosoft SQL Server 2022 (RTM-CU15-GDR) (KB5046059) - 16.0.4150.1 (X64)Developer Edition (64-bit)
ubuntu-22.04-sql.2022.rtm-cu3-1.0.1ubuntu-22.04Microsoft SQL Server 2022 (RTM-CU3) (KB5024396) - 16.0.4025.1 (X64)Developer Edition (64-bit)
ubuntu-22.04-sql.2022.rtm-cu3-1.0.0ubuntu-22.04Microsoft SQL Server 2022 (RTM-CU3) (KB5024396) - 16.0.4025.1 (X64)Developer Edition (64-bit)

⁠Environment Variables

namesample valuedescription
ACCEPT_EULA1Confirms the acceptance of End-User Licensing Agreement.⁠
MSSQL_PIDDeveloperIs the Product ID (PID) or Edition that the container will run with
MSSQL_USERsaDefault sa user
MSSQL_SA_PASSWORD****Is the database system administrator (userid = 'sa')
INCLUDE_SUB_FOLDERStrueIf you want to execute scripts inside of sub-folders
PREVENT_REPEAT_EXECUTIONS_ON_RESTARTtrueIf you want to execute the startup scripts no matter if they were executed in the previous startup
SKIP_ERRORStrueIf you want to skip errors during the scripts executions. By default the execution stops at the slightest error
TZAmerica/LimaYour preferred timezone

More details here: https://hub.docker.com/_/microsoft-mssql-server⁠

⁠/docker-entrypoint-initdb.d

Opposite to the official⁠ version, I added this feature and it works as does it with mysql, postgress, etc. Just mount a local folder.

When a script (example foo.sql) is successfully executed, a file (/var/opt/mssql/log/foo.sql.executed) is created to prevent execute again the same script on restart. Use this variable IGNORE_ALREADY_EXECUTED_SCRIPTS=true to ignore this feature

⁠_seed.order.txt

For few scripts, alphabetical order is enough. For dozens and real databases, the order could be a nightmare.

To use your own execution order, just put a file with name _seed.order.txt in the folder /docker-entrypoint-initdb.d with the relative location of your scripts.

⁠Acknowledgments

⁠Contributors

Tag summary

Content type

Image

Digest

sha256:590071d6b…

Size

529.6 MB

Last updated

almost 2 years ago

docker pull jrichardsz/sql-server-enhanced