5

I have a docker image building through a circle.ci pipeline, it's pulling an ECR image from AWS and hosted on EB/EC2 and its failing to build continuously with this error:

#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

My Docker file

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

  • related:https://stackoverflow.com/questions/76514283/aptpost-invoke-failing-on-debianbookworm-slim – Joren Jun 23 '23 at 20:35

1 Answers1

4

Looks like the version of docker being used needs updating. I was also having this problem using an old version of docker (20.10.6 - don't ask).

There was a Debian release a few days ago. python:3.9-slim derives from this new Debian version and there are some issues with running images based on this Debian version with older versions of docker (certificates and/or keys, updated version of glibc perhaps).

Minimal steps to reproduce (with docker version 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

Following upgrade of docker to 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.
pxul
  • 497
  • 1
  • 3
  • 13
  • Thanks the upgrade worked along with upgrading to `python:3.9-slim-bullseye` – GiarcEnoredlac Jul 10 '23 at 17:16
  • As bullseye was the version of Debian before bookworm this would have been used in the `python:3.9-slim` image before it was [updated](https://github.com/docker-library/python/commit/5d908b0477c003712550c84ac4d133367b912f78) to use bookworm, so if you are using `python:3.9-slim-bullseye` I don't _think_ you would need to upgrade docker. – pxul Jul 11 '23 at 22:33