【问题标题】:Pull and Run a Linux docker image on an azure pipeline在 azure 管道上拉取并运行 Linux docker 映像
【发布时间】:2019-08-16 07:56:26
【问题描述】:

在 AZURE PIPELINE 中拉取并运行基于 Linux docker 的映像时,出现以下错误: “镜像操作系统“Linux”不能在这个平台上使用”

  1. 我创建了一个 Linux docker 映像
  2. 我将图像推送到 Azure 注册表
  3. 我将 Azure 管道设置如下:
    • Docker CLI
    • Azure CLI:
    • 我登录注册表
    • 命令行:
    • 我愿意:docker pull image
    • 我愿意:docker run -it image

当我运行管道时,我收到此错误: “镜像操作系统“Linux”不能在这个平台上使用”

脚本输出:

2019-03-25T21:23:03.4513990Z ##[section]Starting: Command Line Script
2019-03-25T21:23:03.4616971Z ==============================================================================
2019-03-25T21:23:03.4617284Z Task         : Command Line
2019-03-25T21:23:03.4617442Z Description  : Run a command line script using cmd.exe on Windows and bash on macOS and Linux.
2019-03-25T21:23:03.4617592Z Version      : 2.146.1
2019-03-25T21:23:03.4617715Z Author       : Microsoft Corporation
2019-03-25T21:23:03.4618046Z ==============================================================================
2019-03-25T21:23:04.8241638Z Generating script.
2019-03-25T21:23:04.9020040Z ##[command]"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a\_temp\157d3a61-fe5f-46b2-b74e-1082d4532014.cmd""
2019-03-25T21:23:05.7814076Z v1: Pulling from hubb-api-tests
2019-03-25T21:23:06.2370457Z image operating system "linux" cannot be used on this platform
2019-03-25T21:23:06.2872386Z the input device is not a TTY.  If you are using mintty, try prefixing the command with 'winpty'
2019-03-25T21:23:06.3934386Z ##[error]Cmd.exe exited with code '1'.
2019-03-25T21:23:06.4549404Z ##[section]Finishing: Command Line Script

我希望能够提取映像并在 Azure DevOps 管道上运行它,因为我在本地计算机上测试了相同的步骤,没有出现任何问题。

非常感谢你

【问题讨论】:

  • 好像不能在windows平台上运行Linux镜像。如果选择windows web app来部署应用呢?
  • @CharlesXu 感谢您的 cmets。但是在我部署之后我还能在管道中运行它吗?
  • 一般情况下,Linux 镜像可以在 Windows 主机上运行,​​如果你在 Windows 虚拟机上运行 Linux 镜像就可以了。但似乎您无法在 Windows 服务计划上运行 Linux 映像。也许您可以尝试选择一个 Linux 服务计划。

标签: azure docker azure-devops azure-pipelines


【解决方案1】:

您只能使用配置为允许在 Windows 上运行 linux 容器的自己的 Windows 代理来实现此目的。托管代理不允许这样做。

【讨论】:

  • 谢谢你们,感谢你们的帮助。
猜你喜欢
  • 2017-03-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-08-15
相关资源
最近更新 更多