1.首先进入容器
docker exec -ti 容器名称 /bin/bash
例如:docker exec -ti nginx /bin/bash
2.接下来更新下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
现在就能安装软件了:
3.执行命令:
apt-get update && apt-get install vim -y