docker-Ubuntu apt安装软件无法自动安装依赖

背景说明:

docker 拉取Ubuntu镜像使用时,发现apt无法自动安装包相关的依赖,在换源后也是如此。

apt-get update 和 apt install package (以openjdk-11-jdk为例)回显如下两段所示

root@d8e7e722c55a:/testapp# apt-get  update
Ign:1 https://mirrors.bfsu.edu.cn/ubuntu jammy InRelease
Ign:2 https://mirrors.bfsu.edu.cn/ubuntu jammy-updates InRelease
Hit:3 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:5 https://mirrors.bfsu.edu.cn/ubuntu jammy-backports InRelease
Ign:1 https://mirrors.bfsu.edu.cn/ubuntu jammy InRelease
Ign:2 https://mirrors.bfsu.edu.cn/ubuntu jammy-updates InRelease
Ign:5 https://mirrors.bfsu.edu.cn/ubuntu jammy-backports InRelease
Ign:1 https://mirrors.bfsu.edu.cn/ubuntu jammy InRelease
Ign:2 https://mirrors.bfsu.edu.cn/ubuntu jammy-updates InRelease
Ign:5 https://mirrors.bfsu.edu.cn/ubuntu jammy-backports InRelease
Err:1 https://mirrors.bfsu.edu.cn/ubuntu jammy InRelease
  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 39.155.141.16 443]
Err:2 https://mirrors.bfsu.edu.cn/ubuntu jammy-updates InRelease
  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 39.155.141.16 443]
Err:5 https://mirrors.bfsu.edu.cn/ubuntu jammy-backports InRelease
  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 39.155.141.16 443]
Reading package lists... Done
W: https://mirrors.bfsu.edu.cn/ubuntu/dists/jammy/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.bfsu.edu.cn/ubuntu/dists/jammy-updates/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.bfsu.edu.cn/ubuntu/dists/jammy-backports/InRelease: No system certificates available. Try installing ca-certificates.
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:54
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:54
W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:54
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:54
W: Target Packages (universe/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:56
W: Target Packages (universe/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:56
W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:58
W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:58
W: https://mirrors.bfsu.edu.cn/ubuntu/dists/jammy/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.bfsu.edu.cn/ubuntu/dists/jammy-updates/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.bfsu.edu.cn/ubuntu/dists/jammy-backports/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.bfsu.edu.cn/ubuntu/dists/jammy/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.bfsu.edu.cn/ubuntu/dists/jammy-updates/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.bfsu.edu.cn/ubuntu/dists/jammy-backports/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.bfsu.edu.cn/ubuntu/dists/jammy/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.bfsu.edu.cn/ubuntu/dists/jammy-updates/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.bfsu.edu.cn/ubuntu/dists/jammy-backports/InRelease: No system certificates available. Try installing ca-certificates.
W: Failed to fetch https://mirrors.bfsu.edu.cn/ubuntu/dists/jammy/InRelease  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 39.155.141.16 443]
W: Failed to fetch https://mirrors.bfsu.edu.cn/ubuntu/dists/jammy-updates/InRelease  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 39.155.141.16 443]
W: Failed to fetch https://mirrors.bfsu.edu.cn/ubuntu/dists/jammy-backports/InRelease  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 39.155.141.16 443]
W: Some index files failed to download. They have been ignored, or old ones used instead.
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:54
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:54
W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:54
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:54
W: Target Packages (universe/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:56
W: Target Packages (universe/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:56
W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:58
W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:58
root@d8e7e722c55a:/testapp# apt install openjdk-11-jdk
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
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:
 openjdk-11-jre : Depends: libgl1 but it is not installable
                  Depends: libharfbuzz0b but it is not going to be installed
                  Depends: libgif7 (>= 5.1) but it is not installable
                  Depends: libjpeg8 (>= 8c) but it is not installable
                  Depends: libpng16-16 (>= 1.6.2-1) but it is not installable
                  Depends: libx11-6 but it is not going to be installed
                  Depends: libxext6 but it is not installable
                  Depends: libxi6 but it is not installable
                  Depends: libxrender1 but it is not installable
                  Depends: libxtst6 but it is not installable
                  Recommends: libatk-wrapper-java-jni (>= 0.30.4-0ubuntu2) but it is not installable
                  Recommends: fonts-dejavu-extra but it is not installable
 openjdk-11-jre-headless : Depends: ca-certificates-java (>= 20190405~) but it is not going to be installed
                           Depends: java-common (>= 0.28) but it is not installable
                           Depends: liblcms2-2 (>= 2.2+git20110628) but it is not installable
                           Depends: libjpeg8 (>= 8c) but it is not installable
                           Depends: libfontconfig1 but it is not installable
                           Depends: libnss3 (>= 2:3.17.1) but it is not going to be installed
                           Depends: libasound2 (>= 1.0.16) but it is not installable
                           Depends: libfreetype6 (>= 2.3.5) but it is not going to be installed
                           Depends: libharfbuzz0b (>= 1.2.6) but it is not going to be installed
                           Depends: libpcsclite1 (>= 1.3.0) but it is not installable
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:54
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:54
W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:54
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:54
W: Target Packages (universe/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:56
W: Target Packages (universe/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:56
W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:58
W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:58
E: Unable to correct problems, you have held broken packages.

解决方法

 apt-get install --reinstall ca-certificates
 apt-get update

之后再正常执行安装命令即可

apt-get install package-name
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值