更多IT技术文章,欢迎关注微信公众号:运维之美,一个涨姿势的公众号
创建了一个docker,但是vim等基础命令都没有安装,使用apt-get update命令更新源出现如下报错
报错一
root@26eac251281c:/var/lib/apt# apt-get update
Get:1 http://mirrors.sohu.com precise-updates InRelease [8 B]
Ign http://mirrors.sohu.com precise InRelease
Get:2 http://mirrors.sohu.com precise-backports InRelease [8 B]
81% [1 InRelease gpgv 8 B] [Waiting for headers] [Waiting for headers] 1 B/s 0sSIgn http://mirrors.sohu.com precise-updates InRelease
E: GPG error: http://mirrors.sohu.com precise-updates InRelease: Clearsigned file isn't valid, got 'NODATA' (does the network require authentication?)
报错二
E: Some index files failed to download. They have been ignored, or old ones used instead.
最后修改成如下源解决
root@26eac251281c:/# cat /etc/apt/sources.list
# deb http://snapshot.debian.org/archive/debian/20200607T000000Z buster main
deb http://deb.debian.org/debian buster main
# deb http://snapshot.debian.org/archive/debian-security/20200607T000000Z buster/updates main
deb http://security.debian.org/debian-security buster/updates main
# deb http://snapshot.debian.org/archive/debian/20200607T000000Z buster-updates main
deb http://deb.debian.org/debian buster-updates main
由于docker中暂时没有安装vim,我们可以先通过cat命令追加的方式添加源
root@26eac251281c:/# cat >/etc/apt/sources.list <<EOF
> # deb http://snapshot.debian.org/archive/debian/20200607T000000Z buster main
> deb http://deb.debian.org/debian buster main
> # deb http://snapshot.debian.org/archive/debian-security/20200607T000000Z buster/updates main
> deb http://security.debian.org/debian-security buster/updates main
> # deb http://snapshot.debian.org/archive/debian/20200607T000000Z buster-updates main
> deb http://deb.debian.org/debian buster-updates main
> EOF
也可以尝试修改为如下源
# deb http://snapshot.debian.org/archive/debian/20200607T000000Z buster main
deb http://deb.debian.org/debian buster main
# deb http://snapshot.debian.org/archive/debian-security/20200607T000000Z buster/updates main
deb http://security.debian.org/debian-security buster/updates main
# deb http://snapshot.debian.org/archive/debian/20200607T000000Z buster-updates main
deb http://deb.debian.org/debian buster-updates main
最后在执行apt-get update成功,此时你可以通过apt-get install vim进行命令的安装了。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 2025年我用 Compose 写了一个 Todo App
· 张高兴的大模型开发实战:(一)使用 Selenium 进行网页爬虫