I want to run my integration tests against a local Docker-hosted SQL Server 2019 database inside an Azure pipeline. I'm trying to copy over sqlpackage to this Docker image so I can restore a .bacpac each time in order to setup the database before the tests. Here's the YAML config I have so far:
azure-pipelines.yml:
resources:
containers:
- container: 'sqlserver_linux_container_for_integration_tests'
image: 'mcr.microsoft.com/mssql/server:2019-CU5-ubuntu-16.04'
ports:
- 1433:1433/tcp
env:
ACCEPT_EULA: 'Y'
SA_PASSWORD: 'P@ssW0rd!'
trigger:
- azure-pipelines
pool:
vmImage: 'ubuntu-16.04'
variables:
buildConfiguration: 'Release'
steps:
- task: Bash@3
displayName: 'Echo some Docker info from bash'
inputs:
targetType: 'inline'
script: |
echo 'docker info'
docker info
echo 'docker ps'
docker ps
- task: Docker@2
displayName: 'Copy sqlpackage to Docker SQL Server'
inputs:
command: 'cp'
arguments: '$(Agent.BuildDirectory)/s/DBProject/_TestDb_/sqlpackage-linux/sqlpackage sqlserver_linux_container_for_integration_tests:/tmp/sqlpackage'
I want to access the Docker container sqlserver_linux_container_for_integration_tests from my Docker@2 step so I can copy the sqlpackage binary into it - the database .bacpac will later be copied, and sqlpackage will be run to restore the DB from it - but I get the error "Error: No such container:path: sqlserver_linux_container_for_integration_tests:/tmp". So it looks like either the Docker container isn't being started or it's not being made available to my task. In addition, docker ps in the first task shows no output.
So how can I make the Docker container available for my tasks to copy files to and execute commands on?