docker容器中无法安装vim解决方案

docker容器中无法安装vim解决方案

1.docker容器中执行vim失败

在这里插入图片描述

2.正常情况下执行:apt-get update apt-get install -y vim但是由于网络问题这一步会非常慢

3.更换apt源

1.进入容器:docker exec -it redis /bin/bash

2.备份redis源:mv /etc/apt/sources.list /etc/apt/sources.list.bac

3.更换阿里源:

echo "deb http://mirrors.aliyun.com/debian/ bullseye main contrib" >> /etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/debian/ bullseye main contrib" >> /etc/apt/sources.list
echo "deb http://mirrors.aliyun.com/debian/ bullseye-updates main contrib" >> /etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/debian/ bullseye-updates main contrib" >> /etc/apt/sources.list
echo "deb http://mirrors.aliyun.com/debian/ bullseye-backports main contrib" >> /etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/debian/ bullseye-backports main contrib" >> /etc/apt/sources.list
echo "deb http://mirrors.aliyun.com/debian/ bullseye-proposed-updates main contrib" >> /etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/debian/ bullseye-proposed-updates main contrib" >> /etc/apt/sources.list

4.检查配置:cat /etc/apt/sources.list

docker容器中无法安装vim解决方案_第1张图片

4.执行apt-get update

docker容器中无法安装vim解决方案_第2张图片

5.执行apt-get install -y vim

docker容器中无法安装vim解决方案_第3张图片

你可能感兴趣的:(docker,vim,linux,redis)