docker新下载的镜像一般都是不带非必需软件得,常常需要自己安装所需软件,如果执行apt-get install vim提示找不到安装包的时候,说明需要更新
执行: apt-get update
如果报错或者网速慢,就替换其他源
cp /etc/apt/sources.list /etc/apt/sources.list.bak
删除sources.list里面的东西,把以下内容添加上:(电子科技大学的源)
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty main restricted
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty main restricted
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-updates main restricted
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-updates main restricted
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty universe
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty universe
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-updates universe
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-updates universe
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-updates multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-updates multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
deb http://security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse
如果没有安装vi或者vim,无法编辑文件,则使用以下命令:
cat >/etc/apt/sources/list <
紧接着会要求输入需要添加的内容,回车换行,最后换新行后输入EOF结束输入
更新安装包时,如果提示解析域名失败,则需要更换dns服务器ip:
echo "nameserver 1.2.4.8" > /etc/resolv.conf