jenkins Docker构建:#1错误:来自守护程序的错误响应:无此图像:moby/buildkit:buildx-stable-1

0yg35tkg  于 2023-04-19  发布在  Jenkins
关注(0)|答案(1)|浏览(482)

[更新]

这个错误来自一个构建容器,它包含一个被更改的docker版本。升级那个docker版本解决了这个问题。所以在某种程度上这个gitlab/runner: manifest for moby/buildkit:buildx-stable-1 not found是正确的答案,我们的更新尝试一定是在错误的地方。

问题:

我正在尝试使用jenkins运行docker build并发布到AWS中的弹性容器注册表。在不更改jenkinsfile或dockerfiles的情况下,构建现在开始失败。最后一次成功构建运行于2023年1月26日。
Jenkinsfile:

// ...irrelevant stuff...

    def customImage = docker.build("xxxx-builder:latest", "--build-arg BUILDENV=${buildenv} --network=host .")

        customImage.inside("-u 0:0 -e HOME='/tmp' --privileged --network=host -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/NuGetScratch/ -v /tmp/.nuget") {
            sh "docker system prune -f"
            sh "dotnet lambda deploy-function -cfg aws-lambda-tools-${awsservice}.json --aws-access-key-id ${creds[0]} --aws-secret-key ${creds[1]}"
            sh "chown -R jenkins-SAWSMGT:jenkins-SAWSMGT ./"
        }

Dockerfile:

FROM mcr.microsoft.com/dotnet/sdk:5.0

# Required build arguments
ARG BUILDENV

# Environment variables
ENV BUILDENV ${BUILDENV}
ENV PATH="${PATH}:/tmp/.dotnet/tools"
VOLUME /home/jenkins-SAWSMGT

# Install dependencies
RUN apt update && \
    apt install -y \
        apt-transport-https \
        ca-certificates \
        curl \
        gnupg2 \
        software-properties-common && \
    apt-key adv --fetch-keys https://download.docker.com/linux/debian/gpg && \
    add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian buster stable" && \
    apt update && \
    apt install -y zip docker-ce docker-ce-cli containerd.io && \
    rm -rf /var/lib/apt/lists/* && \
    apt clean && \
    apt autoremove -y

# Change user
RUN groupadd -r -g 1015 jenkins-SAWSMGT
RUN useradd -r -u 1014 -g jenkins-SAWSMGT jenkins-SAWSMGT
USER root

# Install AWS Lambda Toolkit
ENV HOME="/tmp"
RUN dotnet tool install -g Amazon.Lambda.Tools

Dockerfile2:

FROM public.ecr.aws/lambda/dotnet:5.0

WORKDIR /var/task

COPY "bin/Release/net5.0/linux-x64/publish"  .

RUN yum install -y amazon-linux-extras
RUN amazon-linux-extras install epel -y
RUN yum install -y \
    libgdiplus \
    libjpeg \
    rpmdevtools \
    wget \
    yum-utils
ENV WKHTMLTOPDF_BIN="wkhtmltopdf.rpm"
RUN wget -O $WKHTMLTOPDF_BIN https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos7.$(arch).rpm \
    && yum install -y $WKHTMLTOPDF_BIN

RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf
RUN mkdir -p /var/lang/lib && cp -fvr /usr/local/lib/* /var/lang/lib/

失败生成的输出:

......... 

Inspecting Dockerfile to figure how to build project and docker image
Executing docker build
... invoking 'docker build', working folder '/data00/jenkins-slaves/SAWSMGT/workspace/XXXX, docker file /data00/jenkins-slaves/SAWSMGT/workspace/XXXX/Dockerfile2, image name xxxx:dev'
... docker build  -f "/data00/jenkins-slaves/SAWSMGT/workspace/XXXX/Dockerfile2" -t xxxx:dev --network=host .
... docker build: #1 [internal] booting buildkit
... docker build: #1 pulling image moby/buildkit:buildx-stable-1
... docker build: #1 pulling image moby/buildkit:buildx-stable-1 1.4s done
... docker build: #1 creating container buildx_buildkit_default 0.0s done
... docker build: #1 ERROR: Error response from daemon: No such image: moby/buildkit:buildx-stable-1
... docker build: ------
... docker build:  > [internal] booting buildkit:
... docker build: ------
... docker build: WARNING: No output specified with docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
... docker build: ERROR: Error response from daemon: No such image: moby/buildkit:buildx-stable-1
Error executing "docker build"
Error executing "docker build"

我尝试将.NET版本更改为新版本和旧版本,尝试添加--load或--push作为构建选项,但没有成功。
有什么想法吗???

wgmfuz8q

wgmfuz8q1#

通过升级docker版本在我的centos 7.x上修复它

$ yum remove docker \
  docker-client \
  docker-client-latest \
  docker-common \
  docker-latest \
  docker-latest-logrotate \
  docker-logrotate \
  docker-engine
$ yum install -y yum-utils
$ yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
$ yum install docker-ce docker-ce-cli containerd.io
$ systemctl start docker
$ systemctl enable docker

相关问题