You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GitLab共享Runner Docker版本过低不支持多阶段构建求助

问题:GitLab共享Runner升级Docker版本以支持多阶段构建

问题背景

我在GitLab Runner中运行含多阶段构建的Dockerfile时,流水线执行失败,以下是详细信息:

所用Dockerfile

FROM alpine:3.18 as alpine
RUN ...

初始流水线配置

image: gitlab/dind

services:
  - docker:dind


stages:
  - init
  - build
init:
  stage: init
  script:
    git clone MY_REPO
  artifacts:
    paths:
      - cicdtest

build:
  stage: build
  script:
    - docker build -t registry.gitlab.com/mytest cicdtest/. --no-cache

报错信息

Step 1 : FROM alpine:3.18 as alpine
Error parsing reference: "alpine:3.6 as alpine" is not a valid repository/tag

尝试的修改

我尝试在流水线中提前拉取镜像,修改后的配置如下,但仍出现相同错误:

image: gitlab/dind

services:
  - docker:dind


stages:
  - init
  - build
init:
  stage: init
  script:
    git clone MY_REPO
  artifacts:
    paths:
      - cicdtest

build:
  stage: build
  script:
    - docker pull alpine:3.18
    - docker build -t registry.gitlab.com/mytest  cicdtest/. --no-cache

排查结果

经检查,当前Runner使用的Docker版本为Docker version 1.12.1, build 23cf638,而多阶段构建是Docker 17.05及以上版本才支持的特性。docker info输出如下:

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 1.12.1
Storage Driver: overlay2
 Backing Filesystem: extfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: host bridge overlay null
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: apparmor
Kernel Version: 5.4.109+
Operating System: Ubuntu 14.04.5 LTS (containerized)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.776 GiB
Name: runner
ID: XXXXXXX
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Insecure Registries:
 127.0.0.0/8

求助

如何将GitLab共享Runner的Docker版本升级至17.05?

内容的提问来源于stack exchange,提问作者sally

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 08:34:54