I am running a docker image on 2 different computers and the contents of said image are different.
I am ensuring they are the same image by specifying the digest as such
docker run -it ubuntu@sha256:f9d633ff6640178c2d0525017174a688e2c1aef28f0a0130b26bd5554491f0da /bin/bash
however when I run
cat /etc/apt/sources.list
I am getting very different contents. Furthermore when I try to do apt-get update && apt-get install curl -y
on one computer I get 400 bad request errors and is unable to install while on the other computer it works just fine.
The bad computer has mirror URIs that are mostly from ubuntu-ports, i.e. ports.ubuntu.com/ubuntu-ports
while the good computer is mostly archive.ubuntu.com
I dont believe this file is generated at runtime so I cannot figure out what is causing this discrepancy.
2
Answers
The issue you’re facing seems to be due to differences in the package repository configuration (
/etc/apt/sources.list
) between the two computers. This file determines where apt looks for packages and updates.The fact that one computer has mirror URIs from
ports.ubuntu.com/ubuntu-ports
while the other hasarchive.ubuntu.com
suggests that they are configured to use different repositories. This could be causing the differences in behavior when runningapt-get update
andapt-get install
.You may try to double-check the following:
Double-check that the Docker image being used is indeed the same on both computers. Sometimes, even with the same digest, there could be variations due to how the image was built or where it was pulled from.
If you want both computers to use the same repositories, you can manually edit
/etc/apt/sources.list
on the computer with the undesired mirror URIs to match the configuration of the other computer. You can replaceports.ubuntu.com/ubuntu-ports
witharchive.ubuntu.com
in the file.You have pulled the image for two different platforms. The digest you provided is the top level manifest list that has references to multiple platform specific images:
Checking the requested file on AMD64 shows the archive URLs:
However on ARM64, they use the ports URLs:
You can check your host platform with commands like
uname
.