我使用以下方法成功地炮击到Docker容器:
docker exec-i-t 69f1711a205e bash
现在我需要编辑文件,但里面没有任何编辑器:
[email protected]:/#纳米
bash:nano:未找到命令
[email protected]:/#微微
bash:pico:未找到命令
[email protected]:/#vi
bash:vi:未找到命令
[email protected]:/#vim
bash:vim:未找到命令
[email protected]:/#emacs
bash:emacs:未找到命令
[email protected]:/#
如何编辑文件
与注释中一样,没有默认编辑器集-奇怪-环境变量$editor为空。您可以通过以下方式登录到容器:
docker exec-it<;集装箱>;猛击
并运行:
apt获取更新
apt获取并安装vim
或使用以下Dockerfile:
来自confluent/postgres bw:0.1的
运行[“apt get”,“update”]
运行[“apt-get”、“install”、“-y”、“vim”]
Docker图像被裁剪到最低限度,因此装运的容器中没有安装编辑器。这就是为什么需要手动安装它
编辑
我也鼓励你阅读我关于这个话题的帖子