Automatically execute SQL files mounted in a specific directory upon container creation
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.
hi @axelfontaine, looks like duplicate of #4?
@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.
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 :wink:
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.
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
@here Hello folks, Is there any ETA on this feature request?