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

查看:14
本文介绍了Gitlab CI - 错误:作业失败:执行程序需要 OSType=linux,但 Docker 引擎仅支持 OSType=windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

<块引用>

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

我的 CI:

图像:hello-world:nanoserver阶段:- 建造构建1:阶段:构建脚本:- 回声你好世界"

解决方案

<块引用>

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

一些图片已经分开了简单标签"和共享标签"部分在支持的标签和相应的 Dockerfile 链接"下(参见 mongo以图片为例).

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

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

简单标签"使 docker run mongo:4.0-xenial 能够做正确的事"在单一平台上跨体系结构的事物"(在 Linux 的情况下mongo:4.0-xenial).共享标签"使 docker run mongo:4.0 能够大致适用于 Linux 和许多不同版本的受支持的 Windows(例如 Windows Server Core LTSC 2016、Docker 守护进程再次负责确定基于主机平台和版本的适当图像).

我建议你尝试共享标签:

图片:hello-world

最新的标签有:

linux/386视窗 v10.0.17134.1069/amd64视窗 v10.0.17763.802/amd64

Docker 会为您挑选合适的

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

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

Getting this error while running Gitlab CI pipeline. As I understand the error says that I'm trying to run a Linux type docker image on a windows docker-engine? But the thing is I'm using a windows docker image. What could be the problem?

ERROR: Job failed: executor requires OSType=linux, but Docker Engine supports only OSType=windows

My 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).

"Simple Tags" are instances of a "single" Linux or Windows image. 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. The Docker daemon is responsible for picking the appropriate image for the host architecture.

"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.

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). 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).

I suggest you to try shared tags:

image: hello-world

the latest tag has:

linux/386

windows v10.0.17134.1069/amd64

windows v10.0.17763.802/amd64

and Docker will pick up the right one for you

From here you need the executer docker-windows to run Windows Container

so you may add executor = "docker-windows" to your runners config

这篇关于Gitlab CI - 错误:作业失败:执行程序需要 OSType=linux,但 Docker 引擎仅支持 OSType=windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆