Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically execute SQL files mounted in a specific directory upon container creation #245

Open
axelfontaine opened this issue Jan 26, 2018 · 6 comments

Comments

@axelfontaine
Copy link

We run SQL Server as part of a Docker Compose setup that starts a bunch of databases from different vendors to test our product Flyway (https://flywaydb.org).

As part of this setup we need to create a number of different SQL Server databases for our various test cases.

It would be great to be able to mount a volume say to /sql that contains a bunch of SQL scripts that would be executed in alphabetical order once the database server is up and running.

Right now we have to override the entrypoint to do this. Other images like postgres and mysqlsupport this out of the box and it's super useful.

@nerro
Copy link

nerro commented Jan 31, 2018

hi @axelfontaine, looks like duplicate of #4?

@axelfontaine
Copy link
Author

@nerro It's closer to #2 actually, except this variant allows for more customization. In our case we need to create 4-5 databases on container startup.

@nerro
Copy link

nerro commented Jan 31, 2018

For my use case I created a new entrypoint (bash script) and create databases depending on env variables. If you need it I can share it with you.

P.S. your talks on JAX are always good 😉

@twright-msft
Copy link
Collaborator

We envision this "feature" too because it will give you a lot of flexibility in what you can do. It could be used to create logins, populate test data, run some maintenance scripts, etc. Let's keep this here as a distinct enhancement request until we can get to it.

@0xced
Copy link

0xced commented Sep 13, 2018

I used the genschsa/mssql-server-linux image which does it exactly like the postgres and mysql/mysql-server images, i.e.

docker run -p 1433:1433 --name mssql -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=Strong(!)Password' -v $PWD/initdb.d:/docker-entrypoint-initdb.d -d genschsa/mssql-server-linux

@gsajwan
Copy link

gsajwan commented Oct 13, 2021

@here Hello folks,
Is there any ETA on this feature request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants