Search code examples
linuxdockerubuntuaptapt-get

docker images on different computers are different


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.


Solution

  • 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:

    $ regctl manifest get ubuntu@sha256:f9d633ff6640178c2d0525017174a688e2c1aef28f0a0130b26bd5554491f0da
    Name:        ubuntu@sha256:f9d633ff6640178c2d0525017174a688e2c1aef28f0a0130b26bd5554491f0da
    MediaType:   application/vnd.oci.image.index.v1+json
    Digest:      sha256:f9d633ff6640178c2d0525017174a688e2c1aef28f0a0130b26bd5554491f0da
    
    Manifests:
    
      Name:      docker.io/library/ubuntu@sha256:81bba8d1dde7fc1883b6e95cd46d6c9f4874374f2b360c8db82620b33f6b5ca1
      Digest:    sha256:81bba8d1dde7fc1883b6e95cd46d6c9f4874374f2b360c8db82620b33f6b5ca1
      MediaType: application/vnd.oci.image.manifest.v1+json
      Platform:  linux/amd64
    
      Name:      docker.io/library/ubuntu@sha256:9089166d0211acd54441bb6a532f69e0038287edf625d62fda94784df7f07474
      Digest:    sha256:9089166d0211acd54441bb6a532f69e0038287edf625d62fda94784df7f07474
      MediaType: application/vnd.oci.image.manifest.v1+json
      Platform:  linux/arm/v7
    
      Name:      docker.io/library/ubuntu@sha256:ca165754e2f953a4f686409b1eb5855212f42a252462c9c50bbc3077f3b9a654
      Digest:    sha256:ca165754e2f953a4f686409b1eb5855212f42a252462c9c50bbc3077f3b9a654
      MediaType: application/vnd.oci.image.manifest.v1+json
      Platform:  linux/arm64
    
      Name:      docker.io/library/ubuntu@sha256:2f00029acbafa8e205f18a167658ea1546d754e79641b667b77295f9e0e77766
      Digest:    sha256:2f00029acbafa8e205f18a167658ea1546d754e79641b667b77295f9e0e77766
      MediaType: application/vnd.oci.image.manifest.v1+json
      Platform:  linux/ppc64le
    
      Name:      docker.io/library/ubuntu@sha256:66874e931f0e488d3d20b8276b98fa58476e537386cc893b464e2eb89de8cec8
      Digest:    sha256:66874e931f0e488d3d20b8276b98fa58476e537386cc893b464e2eb89de8cec8
      MediaType: application/vnd.oci.image.manifest.v1+json
      Platform:  linux/s390x
    

    Checking the requested file on AMD64 shows the archive URLs:

    $ regctl image cat --platform linux/amd64 ubuntu@sha256:f9d633ff6640178c2d0525017174a688e2c1aef28f0a0130b
    26bd5554491f0da /etc/apt/sources.list
    # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
    # newer versions of the distribution.
    deb http://archive.ubuntu.com/ubuntu/ jammy main restricted
    # deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted
    
    ## Major bug fix updates produced after the final release of the
    ## distribution.
    deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted
    # deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted
    
    ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    ## team. Also, please note that software in universe WILL NOT receive any
    ## review or updates from the Ubuntu security team.
    deb http://archive.ubuntu.com/ubuntu/ jammy universe
    # deb-src http://archive.ubuntu.com/ubuntu/ jammy universe
    deb http://archive.ubuntu.com/ubuntu/ jammy-updates universe
    # deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates universe
    
    ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    ## team, and may not be under a free licence. Please satisfy yourself as to
    ## your rights to use the software. Also, please note that software in
    ## multiverse WILL NOT receive any review or updates from the Ubuntu
    ## security team.
    deb http://archive.ubuntu.com/ubuntu/ jammy multiverse
    # deb-src http://archive.ubuntu.com/ubuntu/ jammy multiverse
    deb http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse
    # deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse
    
    ## N.B. software from this repository may not have been tested as
    ## extensively as that contained in the main release, although it includes
    ## newer versions of some applications which may provide useful features.
    ## Also, please note that software in backports WILL NOT receive any review
    ## or updates from the Ubuntu security team.
    deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
    # deb-src http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
    
    deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted
    # deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted
    deb http://security.ubuntu.com/ubuntu/ jammy-security universe
    # deb-src http://security.ubuntu.com/ubuntu/ jammy-security universe
    deb http://security.ubuntu.com/ubuntu/ jammy-security multiverse
    # deb-src http://security.ubuntu.com/ubuntu/ jammy-security multiverse
    

    However on ARM64, they use the ports URLs:

    $ regctl image cat --platform linux/arm64 ubuntu@sha256:f9d633ff6640178c2d0525017174a688e2c1aef28f0a0130b
    26bd5554491f0da /etc/apt/sources.list
    # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
    # newer versions of the distribution.
    deb http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted
    # deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted
    
    ## Major bug fix updates produced after the final release of the
    ## distribution.
    deb http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted
    # deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted
    
    ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    ## team. Also, please note that software in universe WILL NOT receive any
    ## review or updates from the Ubuntu security team.
    deb http://ports.ubuntu.com/ubuntu-ports/ jammy universe
    # deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy universe
    deb http://ports.ubuntu.com/ubuntu-ports/ jammy-updates universe
    # deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-updates universe
    
    ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    ## team, and may not be under a free licence. Please satisfy yourself as to
    ## your rights to use the software. Also, please note that software in
    ## multiverse WILL NOT receive any review or updates from the Ubuntu
    ## security team.
    deb http://ports.ubuntu.com/ubuntu-ports/ jammy multiverse
    # deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy multiverse
    deb http://ports.ubuntu.com/ubuntu-ports/ jammy-updates multiverse
    # deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-updates multiverse
    
    ## N.B. software from this repository may not have been tested as
    ## extensively as that contained in the main release, although it includes
    ## newer versions of some applications which may provide useful features.
    ## Also, please note that software in backports WILL NOT receive any review
    ## or updates from the Ubuntu security team.
    deb http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe multiverse
    # deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe multiverse
    
    deb http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted
    # deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted
    deb http://ports.ubuntu.com/ubuntu-ports/ jammy-security universe
    # deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-security universe
    deb http://ports.ubuntu.com/ubuntu-ports/ jammy-security multiverse
    # deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-security multiverse
    

    You can check your host platform with commands like uname.