microsoft / mssql-docker

Official Microsoft repository for SQL Server in Docker resources
MIT License
1.71k stars 755 forks source link

linux - init db #519

Closed lkurzyniec closed 4 years ago

lkurzyniec commented 4 years ago

It would be great to have a possibility to initialize fresh instance with some data:

nocentino commented 4 years ago

If I understand your request correctly, this example should do what you're asking. This is part of a larger example using replication, but the initialization of the databases will use the same method.

[https://github.com/microsoft/sql-server-samples/tree/master/samples/containers/replication/db1]

lkurzyniec commented 4 years ago

Yes, it looks like what I need, what I expect. I will try it this week and let you know about the results. Thanks!

lkurzyniec commented 4 years ago

After couple of hours, it works as intended - it is possible to start the container with initialized db. Honestly, it's quite hard to achieve. It's much simpler in case of either mysql or mongodb. You should make it more devfriendly ;)

One more thing - you should add 'How to' instructions onto docker hub, because people are asking about it (e.g. your issue here).

Here is my working example: https://github.com/lkurzyniec/netcore-boilerplate