0

The podman build is failing with a Docker cleanup operation and memory allocation errors.

My simplified Containerfile is:

    FROM docker.io/php:8.1-apache
    RUN apt-get update
    CMD ["apache2-foreground"]

This has an error Problem executing scripts APT::Update::Post-Invoke that is apparently caused by a Docker cleanup operation.

    STEP 1: FROM docker.io/php:8.1-apache
    STEP 2: RUN apt-get 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 bookworm-updates/main amd64 Packages [4732 B]
    Get:6 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [48.0 kB]
    Fetched 9204 kB in 1s (8706 kB/s)
    Reading package lists...
    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
    Error: error building at STEP "RUN apt-get update": error while running runtime: exit status 100

The Docker cleanup command can be disabled by adding RUN mv /etc/apt/apt.conf.d/docker-clean /etc/apt/apt.conf.d/docker-clean.disabled, but this shouldn't be necessary. How do we fix this properly? The following Containerfile builds and the container will run.

    FROM docker.io/php:8.1-apache
    
    RUN mv /etc/apt/apt.conf.d/docker-clean /etc/apt/apt.conf.d/docker-clean.disabled
    RUN apt-get update
    
    CMD ["apache2-foreground"]

However, adding other apt-get commands cause memory allocation errors. It fails trying to add apt-get upgrade -y, or even apt-get install -y wget as shown below:

    FROM docker.io/php:8.1-apache
    
    RUN mv /etc/apt/apt.conf.d/docker-clean /etc/apt/apt.conf.d/docker-clean.disabled
    RUN apt-get update
    
    RUN apt-get install -y wget
    
    CMD ["apache2-foreground"]

In the build results, note lzma error: Cannot allocate memory when trying to decompress the wget archive.

    STEP 1: FROM docker.io/php:8.1-apache
    STEP 2: RUN mv /etc/apt/apt.conf.d/docker-clean /etc/apt/apt.conf.d/docker-clean.disabled
    --> Using cache 19e055f778a12ee0e7bdc3b0474e8013dddf7763ffdee6d7c51b04854dbbe48c
    --> 19e055f778a
    STEP 3: RUN apt-get update
    --> Using cache 9acf978dd9eae527716a6684a2f71068005d047526398bf1b74d811e7e3ca006
    --> 9acf978dd9e
    STEP 4: RUN apt-get install -y wget
    Reading package lists...
    Building dependency tree...
    Reading state information...
    The following NEW packages will be installed:
      wget
    0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
    Need to get 984 kB of archives.
    After this operation, 3692 kB of additional disk space will be used.
    Get:1 http://deb.debian.org/debian bookworm/main amd64 wget amd64 1.21.3-1+b2 [984 kB]
    debconf: delaying package configuration, since apt-utils is not installed
    Fetched 984 kB in 0s (21.4 MB/s)
    dpkg-deb (subprocess): decompressing archive '/var/cache/apt/archives/wget_1.21.3-1+b2_amd64.deb' (size=983848) member 'control.tar': lzma error: Cannot allocate memory
    tar: This does not look like a tar archive
    tar: Exiting with failure status due to previous errors
    dpkg-deb: error: tar subprocess returned error exit status 2
    dpkg: error processing archive /var/cache/apt/archives/wget_1.21.3-1+b2_amd64.deb (--unpack):
     dpkg-deb --control subprocess returned error exit status 2
    Errors were encountered while processing:
     /var/cache/apt/archives/wget_1.21.3-1+b2_amd64.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    Error: error building at STEP "RUN apt-get install -y wget": error while running runtime: exit status 100

There appears to be lots of memory available. The following is from the version above that we managed to get running by disabling the Docker cleanup, but not yet doing other apt-get operations.

    root@pod_leask:/var/www/html# free
                   total        used        free      shared  buff/cache   available
    Mem:        24494592     6875476    14715284      128916     3444304    17619116
    Swap:       33554428           0    33554428

1 Answer 1

2

It turns out the FROM docker.io/php:8.1-apache created a Debian 12 (bookworm) container, but our host machine is running Debial 11 (bullseye). We forced the container to use bullseye so it matches the host by using FROM docker.io/php:8.1-apache-bullseye. The docker-clean problem and the cannot allocate memory problem both went away.

Here is our new working Containerfile. (of course our full file is more complex that this, but it works too)

    FROM docker.io/php:8.1-apache-bullseye
    
    RUN apt-get update
    RUN apt-get install -y wget
    
    CMD ["apache2-foreground"]

However, why should this matter. Is there a kernal difference between bullseye and bookworm that impacts the containers? I thought the container should be independent of the Debian version. Forcing the same version solves the immediate problem, so I'm going to consider this solved and move on.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .