bash:apt-get:找不到命令(在ubuntu docker映像上)

问题描述 投票:0回答:1

基于此图像在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怎么了?

UPDATE:

其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

docker ubuntu apt-get
1个回答
1
投票

elasticsearch映像不是基于Ubuntu的。

Docker不是在模拟内核,而是在每个容器中使用主机系统的(已经运行)内核,因此每个容器中的内核信息将是主机的内核信息。您的主机是Ubuntu,但映像不是。

© www.soinside.com 2019 - 2024. All rights reserved.