简体   繁体   English

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

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

Getting this error while running Gitlab CI pipeline.运行 Gitlab CI 管道时出现此错误。 As I understand the error says that I'm trying to run a Linux type docker image on a windows docker-engine?据我了解,错误表明我正在尝试在 windows docker-engine 上运行 Linux 类型 docker 图像? But the thing is I'm using a windows docker image.但问题是我使用的是 windows docker 图像。 What could be the problem?可能是什么问题呢?

ERROR: Job failed: executor requires OSType=linux, but Docker Engine supports only OSType=windows错误:作业失败:执行程序需要 OSType=linux,但 Docker 引擎仅支持 OSType=windows

My CI:我的 CI:

image: hello-world:nanoserver

stages:
  - build

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

What's the difference between "Shared" and "Simple" tags? “共享”和“简单”标签有什么区别?

Some images have separated "Simple Tags" and "Shared Tags" sections under "Supported tags and respective Dockerfile links" (see the mongo image for an example).一些图像在“支持的标签和相应的 Dockerfile 链接”下将“简单标签”和“共享标签”部分分开(参见 mongo 图像以获取示例)。

"Simple Tags" are instances of a "single" Linux or Windows image. “简单标签”是“单个”Linux 或 Windows 图像的实例。 It is often a manifest list that can include the same image built for other architectures;它通常是一个清单列表,可以包含为其他架构构建的相同映像; for example, mongo:4.0-xenial currently has images for amd64 and arm64v8.例如,mongo:4.0-xenial 目前有 amd64 和 arm64v8 的图像。 The Docker daemon is responsible for picking the appropriate image for the host architecture. Docker 守护进程负责为主机架构挑选合适的镜像。

"Shared Tags" are tags that always point to a manifest list which includes some combination of potentially multiple versions of Windows and Linux images across all their respective images' architectures -- in the mongo example, the 4.0 tag is a shared tag consisting of (at the time of this writing) all of 4.0-xenial, 4.0-windowsservercore-ltsc2016, 4.0-windowsservercore-1709, and 4.0-windowsservercore-1803. “共享标签”是始终指向清单列表的标签,其中包括可能多个版本的 Windows 和 Linux 图像在它们各自的图像架构中的某种组合——在 mongo 示例中,4.0 标签是一个共享标签,由 (在撰写本文时)所有 4.0-xenial、4.0-windowsservercore-ltsc2016、4.0-windowsservercore-1709 和 4.0-windowsservercore-1803。

The "Simple Tags" enable docker run mongo:4.0-xenial to "do the right thing" across architectures on a single platform (Linux in the case of mongo:4.0-xenial). “简单标签”使 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 based on the host platform and version). 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基于主机平台和版本)。

I suggest you to try shared tags:我建议您尝试共享标签:

image: hello-world

the latest tag has: latest的标签有:

linux/386

windows v10.0.17134.1069/amd64

windows v10.0.17763.802/amd64

and Docker will pick up the right one for you Docker 将为您挑选合适的

From here you need the executer docker-windows to run Windows Container这里你需要执行器 docker docker-windows来运行Windows Container

so you may add executor = "docker-windows" to your runners config所以你可以将executor = "docker-windows"添加到你的跑步者配置中

The hello-world:nanoserver image is based from Linux. hello-world:nanoserver映像基于 Linux。 Hence the error message is thrown.因此抛出错误消息。

You are using windows docker engine.您正在使用 windows docker 引擎。 Use winamd64/hello-world使用winamd64/hello-world

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

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