Docker + mssql-server-linux: How to launch .sql file during build (from Dockerfile)

后端 未结 3 1724
长情又很酷
长情又很酷 2021-02-02 11:05

I am trying to create my own Docker image with MSSQL DB for development. It\'s based on microsoft/mssql-server-linux image. During the build I want to copy some

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-02 11:11

    When you build image main process is not running eat. In your case main process is SQL Server.

    Process will run only when you start container with command docker run ...

    And you can make database initialization in this phase. microsoft/mssql-server-linux Dockerfile contains some tips

    Copy all SQL Server runtime files from build drop into image. COPY ./install /

    Just copy into build phase init scripts to ./install dir and it will be executed into start phase.

提交回复
热议问题