0

I have a problem implementing docker-compose.yml file for MS SQL Database container in Docker. I tried to set up "setup.sql" file within "volumes:" parameter but it did not worked out for me. Maybe wrong path? How to correctly set up empty database using ready .sql file stored on local host computer?

Here is the code without volumes parameter:

version: "3.7"
services:
  sql-server-db:
    container_name: sql-server-db
    image: mcr.microsoft.com/mssql/server:2019-latest
    ports:
      - "1433:1433"
    environment:
        SA_PASSWORD: "secret123new!"
        ACCEPT_EULA: "Y"
  • Does that answer your question? https://stackoverflow.com/questions/51050590/run-sql-script-after-start-of-sql-server-on-docker – Dmitrij Kultasev Jul 16 '21 at 14:06
  • @DmitrijKultasev that certainly makes the file accessible from inside the container, but I believe it actually only works for the Express edition. In other editions you have you use a retry-with-sleep loop to wait for SQL Server to finish mounting, validating and upgrading system and user database files before it opens a socket to accept incoming connections, e.g.: [import-data.sh](https://github.com/twright-msft/mssql-node-docker-demo-app#import-datash) – AlwaysLearning Jul 16 '21 at 15:05

0 Answers0