5

I have two bare-metal machines each running Ubuntu LTS 18.04 and docker --version reports 20.10.7 on both.

On each, I've pulled the latest image for ubuntu:22.04. Both report, verbatim:

$ docker pull ubuntu:22.04
22.04: Pulling from library/ubuntu
Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
Status: Image is up to date for ubuntu:22.04
docker.io/library/ubuntu:22.04

$ docker images | grep 'ubuntu\s*22.04'
ubuntu                                             22.04     d2e4e1f51132   2 weeks ago     77.8MB

However: While on the one host machine, an apt update within the container works fine - on the other host we'll get an error-out with return code 100:

$ docker run -it ubuntu:22.04
root@81ddacc04c9f:/# apt update
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
Get:3 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [84.2 kB]
Get:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [109 kB]
Get:5 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [61.3 kB]
Get:6 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [61.0 kB]
Get:7 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [90.7 kB]    
Get:8 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]
Get:9 http://archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [164 kB]                                                                                                  
Get:10 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1792 kB]                                                                                                      
Get:11 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [266 kB]                                                                                                 
Get:12 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [157 kB]                                                                                               
Get:13 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [68.6 kB]                                                                                        
Get:14 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [97.6 kB]                                                                                          
Fetched 20.8 MB in 13s (1641 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
root@81ddacc04c9f:/# echo $?
100

Any subsequent attempts to install packages in that container will therefore fail.

Older ubuntu docker images, eg. ubuntu:18.04 and ubuntu:20.04, are not affected.

2
  • Why do you even need to run apt update inside a Container? That shouldn't really be necessary - the base image should be updated regularly. May 14, 2022 at 20:54
  • 1
    apt update && apt install -y <PACKAGE_NAME> is a common recipe in Dockerfiles, etc. because the update is (in general) necessary to be able to download and install the package and its prerequisites. May 15, 2022 at 12:59

1 Answer 1

2

The problem host machine seems to have had a nonstandard build, probably an older one too.

In addition, the host machine's /etc/apt/sources.list.d/docker.list had a single line in it, which was commented out. One would think this would affect apt update on the host, not on a container, so I'm discounting that as a possible cause.

At any rate, after removing all traces of Docker-CE and its pre-reqs from the errant host machine and reinstalling the latest stable Docker-CE from download.docker.com, the problem has gone away. Lesson learned: MAJOR.MINOR.PATCH doesn't tell the whole story.

2
  • Thank you, this solved my problem too. In particular, "every trace" of docker included the docker.list indicated, and the certs just to be sure, then followed the instructions again on the docker install page. Note: If you've ever dist-upgraded your host (e.g. work laptop) this is likely the cause - using incorrect package builds.
    – tehwalrus
    May 16, 2022 at 19:43
  • Had the same issue on IntelliJ spaces where using FROM ubuntu didn't work. After downgrading to FROM ubuntu:20.04 it worked.
    – Tails
    Nov 21, 2022 at 5:44

You must log in to answer this question.

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