7

N1 docker ubuntu 容器解决 Some index files failed to download. They have been ig...

 2 years ago
source link: https://hellodk.cn/post/869
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

N1 docker ubuntu 容器解决 Some index files failed to download. They have been ignored, or old ones used instead 问题

n1 的 docker,一个 ubuntu 容器在 root 用户下执行 apt-get update 总是遇到 Some index files failed to download. They have been ignored, or old ones used instead 问题,换了好几个国内源都没有解决。

比如下面这篇提到的多个源

但这是为 x86 架构的机器准备的源地址。后来意识到 n1 使用了 arm 架构,docker 容器需要引用 ubuntu-ports 库,网上搜罗了很多,终于发现一篇能用的。

首先使用 docker exec -it leanote /bin/bash 进入 leanote 容器,使用的镜像是 lstcml/n1_leanote:latest

执行 arch 终端输出 aarch64,也就是 arm 架构,往具体了说是 armv8

执行 cat /etc/lsb-release,得到如下输出

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"

可以看出这个容器的确是基于 arm 的 Ubuntu 18.04


备份 sources.list

cp /etc/apt/sources.list /etc/apt/sources.list.bak

修改 sources.list

使用 vim 的话,在命令模式下按两下 g 回到行首,然后输入 :.,$d 删除所有行,然后输入 :set paste,然后按下 i 键进入 vim 的 insert 模式,然后执行粘贴动作(mac 是 command+v),按下 esc,输入 :x 保存并退出。

deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic multiverse
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates multiverse
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security main restricted
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security multiverse

更新软件包索引

再次执行 apt-get update 没有报错了。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK