docker环境安装vim、ifconfig、ping
docker以root权限进入
docker exec -it -u root tomcat /bin/bash
tomcat是容器的名字,不是镜像的名字。
大部分docker环境下没有vim命令,但是可以自行安装,直接执行apt-get install vim,失败
Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package vim
网上百度一番,说是要使用国内镜像,可是不管使用163还是清华的镜像,都报错
E: The repository http://mirrors.163.com/debian jessie-proposed-updates Release does not have a Release file. N: Updating from such a repository cant be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. W: GPG error: http://mirrors.163.com/debian jessie Release: The following signatures couldnt be verified because the public key is not available: NO_PUBKEY 7638D0442B90D010 NO_PUBKEY CBF8D6FD518E17E1
已尝试过多个debian版本的镜像,都是如此
索性尝试一下原始的source.list
直接执行
apt update
这次居然成功了。再执行
apt install -y vim
直接安装成功。
接下来可以安装ifconfig命令了
# net-tools提供ifconfig命令 apt-get install net-tools
安装ping命令
# iputils-ping提供ping命令 apt-get install iputils-ping
