I have been trying to run my data-layer unit test case through pipeline. For database I am using cosmosdb. For runing these test we need cosmosdb emulator which have configured in build pipeline.
- task: azure-cosmosdb.emulator-public-preview.run-cosmosdbemulatorcontainer.CosmosDbEmulator@2
displayName: 'Run Azure Cosmos DB Emulator container'
enabled: true
Here it creates image of container which get created successfully while running pipeline but soon after this it throws error-->
Status: Downloaded newer image for mcr.microsoft.com/cosmosdb/windows/azure-cosmos-emulator:latest
container 65d00cecdf71adbb12accb38f89a9980681ab32b215a1b67e4973d01fc4e912b created from image mcr.microsoft.com/cosmosdb/windows/azure-cosmos-emulator:latest
docker start 65d00cecdf71adbb12accb38f89a9980681ab32b215a1b67e4973d01fc4e912b
Error response from daemon: hcs::CreateComputeSystem 65d00cecdf71adbb12accb38f89a9980681ab32b215a1b67e4973d01fc4e912b: The container operating system does not match the host operating system.
Error: failed to start containers: 65d00cecdf71adbb12accb38f89a9980681ab32b215a1b67e4973d01fc4e912b
Task failed: container 65d00cecdf71adbb12accb38f89a9980681ab32b215a1b67e4973d01fc4e912b failed to start
My host machine is running on Windows and for docker, I do not have dockerfile in my project also docker task in my build pipeline since it all has configured in above task itself. I checked docker version and it is 24.0.7.
How should I resolve this issue?
I can reproduce the same issue in Azure DevOps.
Refer to this doc: Set up a CI/CD pipeline with the Azure Cosmos DB Emulator build task in Azure DevOps
Currently, we are not able to use the Azure Cosmos DB Emulator task in Azure DevOps now.
To solve this issue, we can use the PowerShell script to start the emulator.
For Microsoft-Hosted agent windows-2019:
For self-hosted agent, we need to download and install the latest emulator's MSI package from https://aka.ms/cosmosdb-emulator. Then we can run the Powershell script to start the emulator.