docker - bash:apt-get:找不到命令(在 ubuntu docker 映像上)
问题描述
在基于此图像的 ubuntu docker 容器中:
docker.elastic.co/elasticsearch/elasticsearch:7.7.0
我正在尝试运行apt-get install
(是的,我知道我应该从 dockerfile 构建一个新映像,但仍试图了解它失败的原因)但得到以下错误:
# uname -a
Linux 217054a34cb7 5.3.0-55-generic #49-Ubuntu SMP Thu May 21 12:47:19 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
# apt-get install
bash: apt-get: command not found
从我可以看到上面是 ubuntu 那么怎么了bash: apt-get: command not found
?
更新:
它的 CentOS:
# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
所以它适用于:
yum install openssl
但是为什么会
# uname -a
Linux 217054a34cb7 5.3.0-55-generic #49-Ubuntu SMP Thu May 21 12:47:19 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
返回Ubuntu SMP
?
解决方案
elasticsearch 映像不是基于 Ubuntu 的。
Docker 不是在模拟内核,而是在每个容器中使用主机系统的(已经运行的)内核,因此每个容器中的内核信息将是主机的内核信息。您的主机是 Ubuntu,但映像不是。
推荐阅读
- css - 如何创建变量列并填充它们?
- sql - 在 SQL Server 中,如何捕获所有外部事务?
- c# - System.DllNotFoundException:'gdi32.dll 程序集:
类型: 成员:(空)' - javascript - Mongodb组然后分别计算实例数
- android - 我的活动中的 ViewModel.Observe() 函数没有触发
- python - Bokeh HoverTool 显示“???” 即使在情节中更新了源
- azure - 如何在数据流活动中动态执行 SQL 查询
- solr - solr 核心中的未知土耳其字符
- php - 使用 Livewire 和 Echo 在 Laravel 中捕捉事件
- scala - 错误:未找到:scala 命令字数中的值