title: Docker initialize database tables and records in SQL Server
body: <p>How do you specify initialization database script for SQL Server via <code>docker-compose</code> using SQL script file?</p>
  
  <p><strong>docker-compose.yml</strong></p>
  
  <pre><code>database:
      image: microsoft/mssql-server-linux:2017-latest
      container_name: database
      ports:
        - 1433:1433
      volumes:
        - /var/opt/mssql
      environment:
        SA_PASSWORD: "P@55w0rd"
        ACCEPT_EULA: "Y"
  </code></pre>
  
  <p><strong>schema.sql</strong></p>
  
  <pre><code>CREATE TABLE Department
  (
      Id INT PRIMARY KEY IDENTITY (1, 1),
      Name VARCHAR (50) NOT NULL
  );
  
  CREATE TABLE Student
  (
      Id INT PRIMARY KEY IDENTITY (1, 1),
      Name VARCHAR (50) NOT NULL
  );
  
  CREATE TABLE Course 
  (
      Id INT PRIMARY KEY IDENTITY (1, 1),
      Name VARCHAR (50) NOT NULL
  );
  
  INSERT INTO Student (Id, Name) VALUES(1, "John Doe");
  INSERT INTO Student (Id, Name) VALUES(2, "Jane Doe");
  </code></pre>