再过3分钟你就能了解Docker容器中如何安装vim啦

192 阅读1分钟

进入容器

1. 备份

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

1.1 官方

echo -e "deb http://archive.ubuntu.com/ubuntu/ focal main restricted\ndeb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted\ndeb http://archive.ubuntu.com/ubuntu/ focal universe\ndeb http://archive.ubuntu.com/ubuntu/ focal-updates universe\ndeb http://archive.ubuntu.com/ubuntu/ focal multiverse\ndeb http://archive.ubuntu.com/ubuntu/ focal-updates multiverse\ndeb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse\ndeb http://security.ubuntu.com/ubuntu/ focal-security main restricted\ndeb http://security.ubuntu.com/ubuntu/ focal-security universe\ndeb http://security.ubuntu.com/ubuntu/ focal-security multiverse\n">/etc/apt/sources.list

1.2 163

echo -e "deb https://mirrors.163.com/ubuntu/ focal main restricted universe multiverse\ndeb https://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse\ndeb https://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse\ndeb https://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse">/etc/apt/sources.list

2. 更新

apt update

apt-get install vim -y