mssql-docker icon indicating copy to clipboard operation
mssql-docker copied to clipboard

feat: run init sql script on first time run

Open cboudereau opened this issue 5 years ago • 6 comments

Using init scripts is a quite common pattern in sql docker images like mysql does for instance.

The purpose of this PR is to add into the start.ps1 the ability to check the folder docker-entrypoint-initdb and run all sql scripts inside. Once it is done, the script creates a flag file to avoid running the setup phase on the next startup after a stop.

I updated the README as an alternative.

Let's discuss!

cboudereau avatar Oct 02 '20 10:10 cboudereau

CLA assistant check
All CLA requirements met.

ghost avatar Oct 02 '20 10:10 ghost

Hello.

Is it possible to merge the PR ?

cboudereau avatar Sep 28 '21 09:09 cboudereau

Here, I am looking for same functionality.

EduardoSantanaSeverino avatar Aug 26 '22 16:08 EduardoSantanaSeverino

I created a downstream example that runs an init script when the server is ready (also blocks network connections when not ready/initialized)... should be able to use that as an example to work from.

https://github.com/tracker1/mssql-docker-enhanced

tracker1 avatar Sep 14 '22 22:09 tracker1

Hi @tracker1 , thank you for your comment.

https://github.com/tracker1/mssql-docker-enhanced

I have tried to access to the provided link but it seems to be private repo.

Would considerate to make it public for others to use?

Regards,

Eduardo

EduardoSantanaSeverino avatar Sep 18 '22 18:09 EduardoSantanaSeverino

@EduardoSantanaSeverino sorry, should be public now.

tracker1 avatar Sep 19 '22 18:09 tracker1

Any update ? All the databases even oracle has the

    volumes:
      - ./my/scripts:/docker-entrypoint-initdb.d

In the mid time I added that feature :

https://hub.docker.com/r/usildevops/mssql-docker-enhanced

jrichardsz avatar May 13 '23 00:05 jrichardsz

This is the reason I prefer other SQL vendors (MySQL/Postgres)... This is a feature that should've long existed by now. 🤦‍♂️

shealavington avatar May 17 '23 07:05 shealavington

😭

cboudereau avatar May 17 '23 18:05 cboudereau