在 docker 中运行 Azure 管道任务

时间:2021-01-15 15:44:14

标签: docker azure-devops azure-pipelines

您好,我希望将我们的 jenkins 管道构建移动到 Azure Pipeline 以构建我们的应用程序。

在 Jenkins 中,我们使用的是 groovy 脚本,我们正在本地 docker 镜像中构建我们的应用程序。

在 groovy 中我们使用这个: withDockerContainer(args: '-v /home/jenkins:/home/jenkins ' , image: dockerImage )

来自 Jenkins 文档 (https://www.jenkins.io/doc/pipeline/steps/docker-workflow/)

确实存在在 Azure 中做同样事情的任何方式。我希望能够指定在特定本地 docker 映像中运行特定任务

谢谢

2 个答案:

答案 0 :(得分:0)

您可以使用 container jobs

$('.ac-content').slideToggle();

$("#test").addClass("ac-active");

enter image description here

enter image description here

答案 1 :(得分:0)

<块引用>

确实存在在 Azure 中做同样事情的任何方式。我希望能够指定在特定本地 docker 映像中运行特定任务

答案是肯定的。

如果要在本地 docker 镜像中运行任务,则需要在本地 docker 镜像所在的机器上创建一个私有代理:

然后您可以使用以下脚本来调用本地 docker 镜像:

pool:
  name: YourPrivateAgent

resources:
  containers:
  - container: pycontainer
    image: YourImage

steps:
- task: AnotherTask@1
  target: pycontainer

您可以查看文档 Step target 以了解更多详细信息。