最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - Linux docker container on windows build pipeline - Stack Overflow

programmeradmin2浏览0评论

Using mcr.microsoft/mssql/server:2022 I have made a linux image with a database.

I would like to use this image in my build pipeline, running on Azure DevOps, to run integration tests during a build pipeline, for a .NET Framework project.

Is this possible, without using a self-hosted build agent?

My first thought was to setup the pipeline with two separate jobs, one running linux and the other windows, but I don't know if it is possible to:

  1. Start the windows job when the linux job is ready
  2. Keep the linux job running until the windows job is complete
  3. Connect from the windows job to the sql-server running on the linux job.

Using mcr.microsoft/mssql/server:2022 I have made a linux image with a database.

I would like to use this image in my build pipeline, running on Azure DevOps, to run integration tests during a build pipeline, for a .NET Framework project.

Is this possible, without using a self-hosted build agent?

My first thought was to setup the pipeline with two separate jobs, one running linux and the other windows, but I don't know if it is possible to:

  1. Start the windows job when the linux job is ready
  2. Keep the linux job running until the windows job is complete
  3. Connect from the windows job to the sql-server running on the linux job.
Share Improve this question asked Mar 19 at 13:55 stefanstefan 3131 gold badge2 silver badges15 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 0

You can't run a Linux docker container on a Windows MS-hosted agent, it's not supported.

Start the windows job when the linux job is ready

Each job runs on a separate agent, and there is no connection between them. Therefore, it is impossible to achieve what you said "Start the windows job when the linux job is ready". You can use Dependencies to trigger the Linux job after the windows job is completed, or purchase parallel jobs to let the windows job and the Linux job run at the same time.

Connect from the windows job to the sql-server running on the linux job.

According to the official doc, " Although Microsoft-hosted agents run on Azure public network, they are not assigned public IP addresses. So, external entities cannot target Microsoft-hosted agents." the MS-hosted agent can't be accessed externally, therefore, you can't connect to the sql-server running on another agent.

Based on the current situation, I would suggest you use self-hosted agents.

Check the preinstalled software on the default microsoft hosted images; let's see what's on the the current windows-latest for example:

you'll notice that both WSL and Docker are installed. But there are at least 2 problems for you:

  • at the bottom of the page you can see that the cached docker images are all windows based

  • the WSL installed is version 1, incompatible with recent versions of virutalization environments

You could try to setup a step that updates WSL to v2 and then a command to switch to linux based virtualization for docker. But that's gonna cost you pipeline execution time, and given the particularly pricy costs of Azure, i'd suggest another way;

You could try and use the new windows-2025 image for this pipeline, that comes preinstalled with Docker and WSLv2 as default;

Theoretically this new image has been created specifically to resolve your problem, which is in line with Micro$oft moving towards the windows server + containerized linux services model

发布评论

评论列表(0)

  1. 暂无评论