The apt-get installation software in docker does not work well

Report various errors

apt-get install --no-install-recommends libboost-all-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  autoconf automake autotools-dev cpp-8 gcc-8 gcc-8-base gfortran-8 ibverbs-providers icu-devtools libboost-atomic-dev libboost-atomic1.71-dev libboost-atomic1.71.0 libboost-chrono-dev libboost-chrono1 .71-dev
  libboost-chrono1.71.0 libboost-container-dev libboost-container1.71-dev libboost-container1.71.0 libboost-context-dev libboost-context1.71-dev libboost-context1.71.0 libboost-coroutine-dev
  libboost-coroutine1.71-dev libboost-coroutine1.71.0 libboost-date-time-dev libboost-date-time1.71-dev libboost-date-time1.71.0 libboost-dev libboost-exception-dev libboost-exception1.71-dev
  libboost-fiber-dev libboost-fiber1.71-dev libboost-fiber1.71.0 libboost-filesystem-dev libboost-filesystem1.71-dev libboost-filesystem1.71.0 libboost-graph-dev libboost-graph-parallel-dev
  libboost-graph-parallel1.71-dev libboost-graph-parallel1.71.0 libboost-graph1.71-dev libboost-graph1.71.0 libboost-iostreams-dev libboost-iostreams1.71-dev libboost-iostreams1.71.0 libboost-locale-dev
  libboost-locale1.71-dev libboost-locale1.71.0 libboost-log-dev libboost-log1.71-dev libboost-log1.71.0 libboost-math-dev libboost-math1.71-dev libboost-math1.71.0 libboost-mpi- dev libboost-mpi-python-dev
  libboost-mpi-python1.71-dev libboost-mpi-python1.71.0 libboost-mpi1.71-dev libboost-mpi1.71.0 libboost-numpy-dev libboost-numpy1.71-dev libboost-numpy1.71.0 libboost-program-options -dev
  libboost-program-options1.71-dev libboost-program-options1.71.0 libboost-python-dev libboost-python1.71-dev libboost-python1.71.0 libboost-random-dev libboost-random1.71-dev libboost-random1.71.0
  libboost-regex-dev libboost-regex1.71-dev libboost-regex1.71.0 libboost-serialization-dev libboost-serialization1.71-dev libboost-serialization1.71.0 libboost-stacktrace-dev libboost-stacktrace1.71-dev
  libboost-stacktrace1.71.0 libboost-system-dev libboost-system1.71-dev libboost-system1.71.0 libboost


Get:162 http://archive.ubuntu.com/ubuntu focal/universe amd64 libboost-all-dev amd64 1.71.0.0ubuntu2 [2468 B]
Fetched 81.1 MB in 48s (1703 kB/s)
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/t/tzdata/tzdata_2021e-0ubuntu0.20.04_all.deb 404 Not Found [IP: 185.125.190.36 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/libx/libxml2/libxml2_2.9.10 + dfsg-5ubuntu0.20.04.2_amd64.deb 404 Not Found [IP: 91.189.91.82 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/k/krb5/libkrb5support0_1.17-6ubuntu4.1_amd64.deb 404 Not Found [IP: 91.189.91.82 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/k/krb5/libk5crypto3_1.17-6ubuntu4.1_amd64.deb 404 Not Found [IP: 91.189.91.82 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/k/krb5/libkrb5-3_1.17-6ubuntu4.1_amd64.deb 404 Not Found [IP: 91.189.91.82 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/k/krb5/libgssapi-krb5-2_1.17-6ubuntu4.1_amd64.deb 404 Not Found [IP: 91.189.91.82 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/libx/libx11/libx11-data_1.6.9-2ubuntu1.2_all.deb 404 Not Found [IP: 91.189.91.82 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/libx/libx11/libx11-6_1.6.9-2ubuntu1.2_amd64.deb 404 Not Found [IP: 91.189.91.82 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/o/openssh/openssh-client_8.2p1-4ubuntu0.4_amd64.deb 404 Not Found [IP: 91.189.91.82 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gcc-10/libgfortran5_10.3.0-1ubuntu1~20.04_amd64.deb 404 Not Found [IP: 91.189.91.82 80]
E: Failed to fetch https://developer.download.nvidia.cn/compute/cuda/repos/ubuntu2004/x86_64/./libxnvctrl0_510.47.03-0ubuntu1_amd64.deb File has unexpected size (20538 != 20534). Mirror sync in progress? [IP: 125.44.162.14 443]
   Hashes of expected files:
    - SHA512:626db3993ebe3a789cf5ef19a1a3c7393bca3eb24ab17a5740ace35d2221285692b04f26d6514a24537312b82bc96605a6052c8133a15acc2a0cf2d9f12c2 e22
    - SHA256:24f5df1f1f4b1d3fa7338ea4f7e15d5f0572f37e0980ba04c37eb78e0a9350b2
    - SHA1:db9c7d697a247eed8670fe25c6082d3a9e8f585a [weak]
    - MD5Sum:3d24bb65fb940f1ab11ec1d7b6f90dcf [weak]
    - Filesize:20534 [weak]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?


apt-get install --no-install-recommends libboost-all-dev^C
apt-get update
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:4 http://archive.ubuntu.com/ubuntu focal InRelease
Get:1 https://developer.download.nvidia.cn/compute/cuda/repos/ubuntu2004/x86_64 InRelease [1581 B]
Err:1 https://developer.download.nvidia.cn/compute/cuda/repos/ubuntu2004/x86_64 InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A4B469963BF863CC
Get:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:6 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [2942 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
root@2350fceda618:/d# apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
Reading package lists... Done
Building dependency tree
Reading state information... Done
libprotobuf-dev is already the newest version (3.0.0-9.1ubuntu1.1).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libhdf5-serial-dev : Depends: libhdf5-dev but it is not going to be installed
 libopencv-dev : Depends: libopencv-calib3d-dev (= 3.2.0 + dfsg-4ubuntu0.1) but it is not going to be installed
                 Depends: libopencv-contrib-dev (= 3.2.0 + dfsg-4ubuntu0.1) but it is not going to be installed
                 Depends: libopencv-features2d-dev (= 3.2.0 + dfsg-4ubuntu0.1) but it is not going to be installed
                 Depends: libopencv-highgui-dev (= 3.2.0 + dfsg-4ubuntu0.1) but it is not going to be installed
                 Depends: libopencv-objdetect-dev (= 3.2.0 + dfsg-4ubuntu0.1) but it is not going to be installed
                 Depends: libopencv-stitching-dev (= 3.2.0 + dfsg-4ubuntu0.1) but it is not going to be installed
                 Depends: libopencv-superres-dev (= 3.2.0 + dfsg-4ubuntu0.1) but it is not going to be installed
                 Depends: libopencv-videoio-dev (= 3.2.0 + dfsg-4ubuntu0.1) but it is not going to be installed
                 Depends: libopencv-videostab-dev (= 3.2.0 + dfsg-4ubuntu0.1) but it is not going to be installed
                 Depends: libopencv-viz-dev (= 3.2.0 + dfsg-4ubuntu0.1) but it is not going to be installed
                 Depends: libopencv3.2-java (= 3.2.0 + dfsg-4ubuntu0.1) but it is not going to be installed
                 Depends: libopencv-calib3d3.2 but it is not going to be installed
                 Depends: libopencv-contrib3.2 but it is not going to be installed
                 Depends: libopencv-features2d3.2 but it is not going to be installed
                 Depends: libopencv-highgui3.2 but it is not going to be installed
                 Depends: libopencv-videoio3.2 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Hash Sum mismatch when doing apt-get update and apt-get dist-upgrade

stderr: auto-detected mode as 'legacy'

All kinds of weird questions. . .

Finally, I checked the information on various Baidu and mentioned the source problem, but my source has been replaced by the domestic Alibaba Cloud Tsinghua source, etc., but it still doesn’t work!
I copied the source.list on my local ubuntu1804 system and it still didn’t work!

# deb cdrom:[Ubuntu 18.04.5 LTS _Bionic Beaver_ - Release amd64 (20200806.1)]/ bionic main restricted
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-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://cn.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic universe
deb http://cn.archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free license. 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://cn.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-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://cn.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://security.ubuntu.com/ubuntu bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse
deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic stable
# deb-src [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic stable
deb http://security.ubuntu.com/ubuntu xenial-security main
# deb-src http://security.ubuntu.com/ubuntu xenial-security main
deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable
# deb-src [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable

Then see focal bionic,
bionic for ubuntu1804 system
ubuntu2004 uses focal
But I used the uname -a command to show that the system in docker is 1804, because it is in docker.
The lsb_release -a command is not easy to use if it is not installed, and it will give an error if it is installed!

This can also be seen: cat /etc/lsb-release

root@2350fceda618:/etc/apt# uname -a
Linux 2350fceda618 5.4.0-99-generic #112~18.04.1-Ubuntu SMP Thu Feb 3 14:09:57 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

But no trick, I changed the bionic in /etc/apt/sources.list to focal, and then
apt-get update
apt-get upgrade
This time it is really different, a lot of things have been updated. Then install the software too!
Install lsb_release, I wipe! It shows ubuntu20.04! !

The knowledge points of the article match the official knowledge files, and you can further learn relevant knowledge. Cloud native entry-level skill treeContainer (docker)Install docker15042 people are learning the system