Not getting the same behaviour when using ubuntu:latest or ubuntu@<specific version>

Hi,

I’m using Docker version 20.10.8, build 3967b7d

I’m running this command : docker run -it --rm ubuntu@sha256:817cfe4672284dcbfee885b1a66094fd907630d610cab329114d036716be49ba

When in the container, I try to apt updateand I’m getting the following error:

Get:16 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [880 kB] Get:17 http://archive.ubuntu.com/ubuntu jammy-backports/main amd64 Packages [3175 B] Get:18 http://archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [7290 B] Fetched 24.5 MB in 4s (6138 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

When I’m running simply docker run -it --rm ubuntu:latest, I’m NOT getting this error when updating apt:

Get:16 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1772 kB] Get:17 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [27.5 kB] Get:18 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [55.2 kB] Fetched 24.2 MB in 4s (6191 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done 44 packages can be upgraded. Run 'apt list --upgradable' to see them.

And this albeit the current sha for ubuntu:latest (arm64) is the one above.

Mind that in the ubuntu:latest call, apt looks for “focal*” whereas when using the sea, it looks for “jammy*”…

Any clue why I’m not getting a different behaviour ?

Your Docker version is too old for a Jammy container. I had the same problem some days ago and this is what helped me:

https://pascalroeleven.nl/2021/09/09/ubuntu-21-10-and-fedora-35-in-docker/

So it looks like Docker CE 20.10.8 does not know about a new system call that Ubuntu 22.04 (jammy) uses when you run apt update. It works in Ubuntu 20.04 (focal) containers, because that Ubuntu version uses older libraries.

Then you must have an older “ubuntu:latest” on your machine, because ubuntu latest is jammy now. I tried it, because I thought the latets image was not updated on Docker Hub, but it was.

You should always try to avoid using the latest tag.

Hey,

Thanks for your answer. Yeah, updating Docker fixed the apt issue indeed.

However, there is still something that I quite don’t get : when visiting the page of the ubuntu official image tags (Docker Hub), the link to the amd64 version is Docker Hub

Which is the sha I mentioned above.

But so why aren’t I getting the same behaviour ? Why one uses focal and the other uses jammy ?

As I mentioned before, the latest version is Jammy on Docker hub, so you will see the same hash. If docker run ubuntu:latest runs focal for you, then you have downloaded the image before and Docker will not update it unless you run docker pull ubuntu:latest again.

Ah yeah I figured this (well, re-figured it) out just after replying. This damn latest is local and not global…

Many thanks