bash: file: command not found

我有一个Ubuntu的Docker容器。我在那里安装了一些在Windows编译的Ubuntu应用程序。

它无法执行,我想检查系统架构和文件之间是否存在不匹配。我尝试了这个命令

> file myapp

但不幸的是,输出为空。
> bash: file: command not found

真的,在bin目录下没有“file”命令。它是在其他地方吗?还是我需要安装它?

enter image description here


5执行which file命令,如果没有结果,则表示文件不存在,请安装它。请记住,您正在使用的是Docker容器,可能不具备您所需的所有功能! - George Udosen
1你在容器中安装了coreutils包吗?尝试运行sudo apt-get install coreutils命令并查看结果。 - Koala Yeung
@KoalaYeung 不是在 core-utils 中,而是在 file 包中。 - Zanna
@Zanna 当一个程序是核心工具时,它的结果应该是 /sbin/file 对吗? - George Udosen
@George 看起來 core-utils 的東西在 /bin 目錄下。 - Zanna
1个回答

Docker镜像通常只包含最基本的内容,而似乎创建这个容器的人并没有认为file是必需的。你需要安装它,这个软件包也被称为file

2在执行apt-get install file之前,别忘了先执行apt-get update - Fernando Fabreti