A minimal enhancement of the official https://hub.docker.com/_/microsoft-mssql-server
1.6K
A minimal enhancement of the official https://hub.docker.com/_/microsoft-mssql-server because it lacks of some features
| Feature | description |
|---|---|
| /docker-entrypoint-initdb.d | Almost 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 |
| Healtcheck | There is not an official health check and the proposed script just iterates 60 times XD |
docker pull jrichardsz/sql-server-enhanced:ubuntu-22.04-sql.2022.rtm-cu15-1.0.3
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
And use these parameters to connect from your favourite ide:
| tag | operative system | sql server version | Edition |
|---|---|---|---|
| ubuntu-22.04-sql.2022.rtm-cu15-1.0.3 | Ubuntu 22.04.5 LTS | Microsoft 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.2 | Ubuntu 22.04.5 LTS | Microsoft 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.1 | ubuntu-22.04 | Microsoft SQL Server 2022 (RTM-CU3) (KB5024396) - 16.0.4025.1 (X64) | Developer Edition (64-bit) |
| ubuntu-22.04-sql.2022.rtm-cu3-1.0.0 | ubuntu-22.04 | Microsoft SQL Server 2022 (RTM-CU3) (KB5024396) - 16.0.4025.1 (X64) | Developer Edition (64-bit) |
| name | sample value | description |
|---|---|---|
| ACCEPT_EULA | 1 | Confirms the acceptance of End-User Licensing Agreement. |
| MSSQL_PID | Developer | Is the Product ID (PID) or Edition that the container will run with |
| MSSQL_USER | sa | Default sa user |
| MSSQL_SA_PASSWORD | **** | Is the database system administrator (userid = 'sa') |
| INCLUDE_SUB_FOLDERS | true | If you want to execute scripts inside of sub-folders |
| PREVENT_REPEAT_EXECUTIONS_ON_RESTART | true | If you want to execute the startup scripts no matter if they were executed in the previous startup |
| SKIP_ERRORS | true | If you want to skip errors during the scripts executions. By default the execution stops at the slightest error |
| TZ | America/Lima | Your preferred timezone |
More details here: https://hub.docker.com/_/microsoft-mssql-server
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=trueto ignore this feature
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.
Content type
Image
Digest
sha256:590071d6b…
Size
529.6 MB
Last updated
almost 2 years ago
docker pull jrichardsz/sql-server-enhanced