docker - 重击 : apt-get: command not found (on ubuntu docker image)

标签 docker ubuntu apt-get

在基于此图像的 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,但镜像不是。

关于docker - 重击 : apt-get: command not found (on ubuntu docker image),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62197451/

相关文章:

docker - 构建 docker 并将其推送到不同 CI 构建步骤中的策略,无需 tar

linux - Git:在推送前本地删除后可以恢复文件吗?

linux - 在 Armbian(在 Orange Pi Zero 上)上安装 .Net 5 运行时时出现错误

linux - 软件包,Gentoo 有用命令的 Ubuntu 对应物

python - 管理 Python 包

docker - 将envvars传递到GoCD中的docker容器

无法通过打开的端口访问 Docker 应用程序

docker - 使用Zabbix监控Docker容器

php - Dockerfile Image 命令 '/bin/sh -c apt-get install -y mysqld-server' 返回非零代码 : 100

ubuntu-11.04 - 在没有互联网的情况下使用 apt-get build essential