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

Enable env var for auto creation of MSSQL_DB if var exists and db does not #17

Merged
merged 2 commits into from
Sep 15, 2022

Conversation

potatoqualitee
Copy link
Member

@potatoqualitee potatoqualitee commented Sep 15, 2022

This will help enable database creation at startup.

You can either add it into your compose file

    container_name: mssql1
    hostname: mssql1
    image: dbatools/sqlinstance1
    environment:
      - MSSQL_DB=mydb1
    .......
    container_name: mssql2
    hostname: mssql2
    image: dbatools/sqlinstance2
    environment:
      - MSSQL_DB=mydb2

or at the command line

docker run -p 1433:1433  --volume shared:/shared:z --name mssql1 --hostname mssql1 --network localnet --env MSSQL_DB=mydb1 -d dbatools/sqlinstance
docker run -p 14333:1433  --volume shared:/shared:z --name mssql2 --hostname mssql2 --network localnet --env MSSQL_DB=mydb2 -d dbatools/sqlinstance2

image

To fill need for microsoft/mssql-docker#2 and microsoft/mssql-docker#11. Hat tip 🤠 to https://github.com/twright-msft/mssql-node-docker-demo-app/blob/master/entrypoint.sh

So far this has not been tested on ARM/Edge. Thanks for the 607,356 image pulls as of today! Who knew the empty sqlinstance2 would be twice as popular?

@potatoqualitee potatoqualitee merged commit e6d09d2 into main Sep 15, 2022
@potatoqualitee potatoqualitee deleted the newdb branch September 15, 2022 21:08
@potatoqualitee
Copy link
Member Author

Look into using init.d, entrypoint.d or docker-entrypoint-initdb.d as suggested by the users.

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

Successfully merging this pull request may close these issues.

1 participant