docker中容器(Debian)安装软件

环境:Debian

  1. 修改yum源

  2. 在宿主机上创建sources.list文件

    $ vi /etc/apt/sources.list替换成 deb http://mirrors.aliyun.com/debian wheezy main contrib non-free deb-src http://mirrors.aliyun.com/debian wheezy main contrib non-free deb http://mirrors.aliyun.com/debian wheezy-updates main contrib non-free deb-src http://mirrors.aliyun.com/debian wheezy-updates main contrib non-free deb http://mirrors.aliyun.com/debian-security wheezy/updates main contrib non-free deb-src http://mirrors.aliyun.com/debian-security wheezy/updates main contrib non-free

  3. 拷贝到容器中

    docker cp sources.list 容器名:/etc/apt/sources.list

  4. 进入容器,更新源

    apt-get update 

     apt-get clean &&  apt-get autoclean 清理无用的包(可选)

  5. 安装ip工具

    apt-get install iproute

  6. 删除软件包

apt-get remove package - - purge 删除包,包括删除配置文件等

7.APT其他常用命令

apt-cache search package 搜索包 
apt-cache show package 获取包的相关信息,如说明、大小、版本等

详细参考https://blog.csdn.net/pzw_0612/article/details/52658913

猜你喜欢

转载自blog.51cto.com/jack88/2144854