docker替换源docker镜像安装VIM
创始人
2025-06-01 21:20:48

docker替换源
先看下docker下原有的信息docker info

主要的代码块

 Docker Root Dir: /var/lib/dockerDebug Mode: falseRegistry: https://index.docker.io/v1/Experimental: falseInsecure Registries:127.0.0.0/8Registry Mirrors:https://docker.mirrors.ustc.edu.cn/Live Restore Enabled: false

其中包含了以下这些标识已经配置了国内源,如果没有则进行更新一下:
Registry Mirrors:
https://docker.mirrors.ustc.edu.cn/
在此目录下创建此文件,注:如果存在则进行修改
/etc/docker/daemon.json 添加下面的信息

{"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
}

然后 systemctl restart docker 再进行docker info 查看是否有上图的配置。因为我这里已经配置了所以docker info时已经显示了源

docker镜像下安装vim
首先看下docker的linux内核版本
cat /etc/os-release 这个命令是要登录进去docker镜像后输入

PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

其中如果是debian则可以使用清华大学镜像站
官网地址https://mirrors.tuna.tsinghua.edu.cn/help/debian/ 一定要看下帮助文档
看下自己的Debian 版本,因为有些博客写的镜像地址都是老版本的所以可能会有问题 这是个坑


我的是11(bullseye)
一般情况下,将 /etc/apt/sources.list 文件中 Debian 默认的源地址 http://deb.debian.org/ 替换为镜像地址即可。
Debian Buster 以上版本默认支持 HTTPS 源。如果遇到无法拉取 HTTPS 源的情况,请先使用 HTTP 源并安装:

默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
#默认的安全使用源镜像
deb https://security.debian.org/debian-security bullseye-security main contrib non-free

```bash
echo "">sources.list
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free">>sources.list
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free">>sources.list
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free">>sources.list
echo "deb https://security.debian.org/debian-security bullseye-security main contrib non-free">>sources.list

然后:
apt-get update
apt-get install vim

相关内容

热门资讯

韩国首个商业运载火箭发射失败 韩国首尔时间23日10时13分许,韩国民间运载火箭企业INNOSPACE的首枚商业运载火箭“韩光-纳...
金钛股份业绩下滑,研发占比低,... 文:权衡财经iqhcj研究员 李力编:许辉朝阳金达钛业股份有限公司(简称:金钛股份)拟在北交所上市,...
“新城二代”布局潮玩,打出资本... 斑马消费 陈碧婷继2019年王晓松火线就任,对新城控股力挽狂澜后,如今,他26岁的妹妹王凯莉,正在通...
【开盘】A股三大股指集体小幅高... 12月23日,A股三大股指集体小幅高开。其中,沪指涨0.04%报3919.11点,深成指涨0.05%...
LMArena最新排名:文心大... 12月23日,LMArena 大模型竞技场发布最新排名,文心新模型 ERNIE-5.0-Previe...