docker容器中安裝vim

在使用docker容器時,有時候裏邊沒有安裝vim,敲vim命令時提示說:vim: command not found,這個時候就須要安裝vim,但是當你敲apt-get install vim命令時,提示:docker

        

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package vim

 

        這時候須要敲:apt-get update,這個命令的做用是:同步 /etc/apt/sources.list 和 /etc/apt/sources.list.d 中列出的源的索引,這樣才能獲取到最新的軟件包。vim

        等更新完畢之後再敲命令:apt-get install vim命令便可。ui

配置國內鏡像源

實際在使用過程當中,運行 apt-get update,而後執行 apt-get install -y vim,下載地址因爲是海外地址,下載速度異常慢並且可能中斷更新流程,因此作下面配置:spa

mv /etc/apt/sources.list /etc/apt/sources.list.bak
    echo "deb http://mirrors.163.com/debian/ jessie main non-free contrib" >> /etc/apt/sources.list
    echo "deb http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list
    echo "deb-src http://mirrors.163.com/debian/ jessie main non-free contrib" >>/etc/apt/sources.list
    echo "deb-src http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list
    #更新安裝源
    apt-get update 
相關文章
相關標籤/搜索