我正在尝试使用SQL Server创建Windows容器。 我想在容器创建过程中导入dacpac,但收到此消息。
'powershell [...]命令返回一个非零代码:1
# escape=`
FROM microsoft/mssql-server-windows-developer
ARG SA_PASSWORD
ARG ACCEPT_EULA
ENV SA_PASSWORD=$SA_PASSWORD
ENV ACCEPT_EULA=$ACCEPT_EULA
WORKDIR /tmp
# COPY dacpac file into container
ADD ./MSSQLDB/Snapshots/MSSQLDB.dacpac ./
# download SqlPackage from Microsoft and install
RUN powershell.exe -Command \
$ErrorActionPreference = 'Stop'; \
$ProgressPreference = 'SilentlyContinue'; \
Invoke-WebRequest https://go.microsoft.com/fwlink/?linkid=2113703 -OutFile c:\tmp\DacFramework.msi -UseBasicParsing ; \
Start-Process c:\tmp\DacFramework.msi -ArgumentList '/quiet InstallAllUsers=1 PrependPath=1' -Wait ; \
Remove-Item c:\tmp\DacFramework.msi -Force
*直到这里起作用! *
# run dacpac import
RUN powershell.exe -Command \
Start-Process C:\Program Files\Microsoft SQL Server\150\DAC\bin\SqlPackage.exe -ArgumentList '/Action:Publish /SourceFile:"c:\tmp\MSSQLDB.dacpac" /TargetDatabaseName:"MSSQLDB" /TargetServerName:"localhost"' -Wait
WORKDIR /
EXPOSE 1433