繁体   English   中英

Gitlab CI - 错误:作业失败:执行程序需要 OSType=linux,但 Docker 引擎仅支持 OSType=windows

[英]Gitlab CI - ERROR: Job failed: executor requires OSType=linux, but Docker Engine supports only OSType=windows

运行 Gitlab CI 管道时出现此错误。 据我了解,错误表明我正在尝试在 windows docker-engine 上运行 Linux 类型 docker 图像? 但问题是我使用的是 windows docker 图像。 可能是什么问题呢?

错误:作业失败:执行程序需要 OSType=linux,但 Docker 引擎仅支持 OSType=windows

我的 CI:

image: hello-world:nanoserver

stages:
  - build

build1:
  stage: build
  script:
    - echo "Hello world"

“共享”和“简单”标签有什么区别?

一些图像在“支持的标签和相应的 Dockerfile 链接”下将“简单标签”和“共享标签”部分分开(参见 mongo 图像以获取示例)。

“简单标签”是“单个”Linux 或 Windows 图像的实例。 它通常是一个清单列表,可以包含为其他架构构建的相同映像; 例如,mongo:4.0-xenial 目前有 amd64 和 arm64v8 的图像。 Docker 守护进程负责为主机架构挑选合适的镜像。

“共享标签”是始终指向清单列表的标签,其中包括可能多个版本的 Windows 和 Linux 图像在它们各自的图像架构中的某种组合——在 mongo 示例中,4.0 标签是一个共享标签,由 (在撰写本文时)所有 4.0-xenial、4.0-windowsservercore-ltsc2016、4.0-windowsservercore-1709 和 4.0-windowsservercore-1803。

“简单标签”使 docker 运行 mongo:4.0-xenial 能够在单一平台上跨架构“做正确的事”(Linux 在 mongo:4.0-xenial 的情况下)。 The "Shared Tags" enable docker run mongo:4.0 to roughly work on both Linux and as many of the various versions of Windows that are supported (such as Windows Server Core LTSC 2016, where the Docker daemon is again responsible for determining the appropriate image基于主机平台和版本)。

我建议您尝试共享标签:

image: hello-world

latest的标签有:

linux/386

windows v10.0.17134.1069/amd64

windows v10.0.17763.802/amd64

Docker 将为您挑选合适的

这里你需要执行器 docker docker-windows来运行Windows Container

所以你可以将executor = "docker-windows"添加到你的跑步者配置中

hello-world:nanoserver映像基于 Linux。 因此抛出错误消息。

您正在使用 windows docker 引擎。 使用winamd64/hello-world

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM