首先进入docker容器(前提是容器已经启动):
docker exec -it mysql bash
# mysql是容器名称,换成你自己的
接下来更新下apt-get的源。把下面的命令全部复制粘到容器的控制台执行:
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 && apt-get install vim -y
耐心等命令执行完。
如果提示找不到vim,需要更新apt-get
$ apt-get update
然后再执行install
$ apt-get install vim
西部数码容器云是通过docker技术,在集群服务器上部署容器服务实现的云服务产品。功能强大、简单易用;上万linux镜像,秒级开通,特别适合无技术支撑或运维团队的中小企业及个人用户,容器云产品选购链接 https://www.west.cn/paas/container/