首页 > 解决方案 > 无法在 Windows 上的 Ubuntu 上的 Bash 中从 docker 容器运行 apt-get update

问题描述

我从 Microsoft Store 安装了 Ubuntu 16.04,并按照此处的说明在 Ubuntu 上安装了 docker 。我能够让 docker 运行,但是当我尝试构建我的 docker 映像时,它在这RUN apt-get update一步失败了。同样,当我使用 运行 Ubuntu 容器时docker run -it ubuntu bash,运行apt-get update会给出以下结果

root@266ddcbcf737:/# apt-get update
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [111 kB]
Err:1 http://security.ubuntu.com/ubuntu focal-security InRelease
  At least one invalid signature was encountered.
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]
Err:2 http://archive.ubuntu.com/ubuntu focal InRelease
  At least one invalid signature was encountered.
Err:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  At least one invalid signature was encountered.
Err:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  At least one invalid signature was encountered.
Reading package lists... Done
W: GPG error: http://security.ubuntu.com/ubuntu focal-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://security.ubuntu.com/ubuntu focal-security InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://archive.ubuntu.com/ubuntu focal InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu focal InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://archive.ubuntu.com/ubuntu focal-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu focal-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://archive.ubuntu.com/ubuntu focal-backports InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu focal-backports InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

我尝试清除 apt-cache 并重新生成它,运行apt-get cleanpruning docker 系统,并使用 --allow-unauthenticated但没有任何效果。我从 docker 容器和 ubuntu 运行 df 来检查剩余空间,我的剩余空间超过 20GB,这应该足够了吧?可能是什么问题?

root@653e5734fa23:/# df
Filesystem     1K-blocks      Used Available Use% Mounted on
overlay        215196196 192359380  22836816  90% /
tmpfs          215196196 192359380  22836816  90% /dev
tmpfs          215196196 192359380  22836816  90% /sys/fs/cgroup
rootfs         215196196 192359380  22836816  90% /etc/hosts
shm            215196196 192359380  22836816  90% /dev/shm
root@653e5734fa23:/# exit
exit
me@DESKTOP:~$ df
Filesystem     1K-blocks      Used Available Use% Mounted on
rootfs         215196196 192358800  22837396  90% /
none           215196196 192358800  22837396  90% /dev
none           215196196 192358800  22837396  90% /run
none           215196196 192358800  22837396  90% /run/lock
none           215196196 192358800  22837396  90% /run/shm
none           215196196 192358800  22837396  90% /run/user
cgroup         215196196 192358800  22837396  90% /sys/fs/cgroup
C:\            215196196 192358800  22837396  90% /mnt/c

码头工人信息:

me@DESKTOP~$ docker info
Containers: 1
 Running: 0
 Paused: 0
 Stopped: 1
Images: 3
Server Version: 17.09.0-ce
Storage Driver: overlay2
 Backing Filesystem: <unknown>
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Kernel Version: 4.4.0-18362-Microsoft
Operating System: Ubuntu 16.04.7 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.84GiB
Name: DESKTOP-DOC78SA
ID: CHGU:3AXK:5MJK:XK3H:LXBS:BQJI:AGW6:SF7J:7FG3:BUBD:J55H:VXUM
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No memory limit support
WARNING: No swap limit support
WARNING: No kernel memory limit support
WARNING: No oom kill disable support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support
WARNING: No cpu shares support
WARNING: No cpuset support

标签: dockerubuntuwindows-subsystem-for-linuxapt-get

解决方案


推荐阅读