I've downloaded the Microsoft SQL Server Express image off of Docker Hub. I'm trying to extend it by adding empty databases with empty tables in it and have that output as an image that I can then use throughout my project.
How do I run the following SQL Script?
initdb.sql
USE MASTER
GO
CREATE DATABASE MyDB1
GO
CREATE TABLE [dbo].[MyTable1]
(
[Id] INT NOT NULL,
[Name] NVARCHAR(256) NOT NULL,
)
CREATE TABLE [dbo].[MyTable2]
(
[Id] INT NOT NULL,
[Name] NVARCHAR(256) NOT NULL,
)
GO
-- Create database and tables for Clinical
CREATE DATABASE MyDB2
GO
CREATE DATABASE MyDB3
GO
Here's the Dockerfile I have so far:
FROM microsoft/mssql-server-windows-express AS base
WORKDIR /app
ENV ACCEPT_EULA Y
ENV sa_password supersecretpassword
FROM base AS final
WORKDIR /app
I don't know whether or not to use the CMD command or somehow call SQLCMD but I don't the right way to do that.
Any help would be greatly appreciated.