我正在关注https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-configure-docker?view=sql-server-2017在 macOS 中配置和运行具有持久性的独立 sqlserver 容器数据成功。现在我想创建一个包含两件事的 docker-compose 文件:
- 网络
- 数据库(将 bak 文件从主机复制到容器中并恢复)
我如何实现(2)?
我的码头工人撰写文件:
version: "3"
services:
web:
build:
context: ./webapi
dockerfile: Dockerfile
ports:
- "4010:80"
environment:
- ASPNETCORE_ENVIRONMENT=Development
depends_on:
- db
db:
image: "mcr.microsoft.com/mssql/server:2017-latest"
ports:
- "4009:1433"
volumes:
- "sqlvolume:/var/opt/mssql"
environment:
SA_PASSWORD: "<password>"
ACCEPT_EULA: "Y"
redis:
image: "redis:alpine"
volumes:
sqlvolume: