docker buildx失败,执行脚本APT::Update::Post-Invoke时出现问题

q3qa4bjr  于 2023-06-21  发布在  Docker
关注(0)|答案(1)|浏览(170)

我有一个通过www.example.com管道构建的docker镜像circle.ci,它从AWS中提取ECR镜像并托管在EB/EC2上,并且无法连续构建,并出现以下错误:

#5 0.329 Get:1 http://deb.debian.org/debian bookworm InRelease [147 kB]
#5 0.339 Get:2 http://deb.debian.org/debian bookworm-updates InRelease [52.1 kB]
#5 0.339 Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
#5 0.401 Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8904 kB]
#5 0.548 Get:5 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [27.7 kB]
#5 1.597 Fetched 9179 kB in 1s (7185 kB/s)
#5 1.597 Reading package lists...
#5 2.165 E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true'
#5 2.165 E: Sub-process returned an error code
#5 ERROR: executor failed running [/bin/sh -c apt-get update]: exit code: 100
------
 > [dev 2/7] RUN apt-get update:
------
error: failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c apt-get update]: exit code: 100

我的Docker文件

FROM python:3.9-slim as dev
ENV DEBIAN_FRONTEND=noninteractive
# Custom cache invalidation
ARG CACHEBUST=1
RUN apt-get update
RUN apt-get install -y pipenv default-libmysqlclient-dev libcurl4-openssl-dev libssl-dev

COPY Pipfile* ./
RUN pipenv install --system --deploy --dev

ENV APP_DIR=/app/withinhealth
RUN mkdir -p ${APP_DIR}
WORKDIR ${APP_DIR}

FROM dev as prod
COPY . ./
new9mtju

new9mtju1#

看起来正在使用的docker版本需要更新。我在使用旧版本的docker时也遇到了这个问题(20.10.6-不要问)。
几天前有一个Debian版本。python:3.9-slim来自这个新的Debian版本,并且在运行基于这个Debian版本的镜像时会遇到一些问题,这些镜像与旧版本的docker(证书和/或密钥,可能是glibc的更新版本)。
复制的最小步骤(使用docker版本20.10.6):

$ docker run --rm -it python:3.9-slim bash
root@f350ecdf0140:/# apt update
Get:1 http://deb.debian.org/debian bookworm InRelease [147 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [52.1 kB]
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8904 kB]
Get:5 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [28.3 kB]
Fetched 9180 kB in 2s (5210 kB/s)
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true'
E: Sub-process returned an error code

将Docker升级到24.0.2

$ docker run --rm -it python:3.9-slim bash
root@6824359f6240:/# apt update
Get:1 http://deb.debian.org/debian bookworm InRelease [147 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [52.1 kB]
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8904 kB]
Get:5 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [28.3 kB]
Fetched 9180 kB in 2s (5248 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

相关问题