bash:apt-get:找不到命令(在 ubuntu docker 图像上)
bash: apt-get: command not found (on ubuntu docker image)
在基于此图像的 ubuntu docker 容器内:
docker.elastic.co/elasticsearch/elasticsearch:7.7.0
我正在尝试 运行 apt-get install
(是的,我知道我应该从 docker 文件构建一个新图像,但仍在尝试理解它失败的原因)但是得到以下错误:
# 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
return Ubuntu SMP
?
elasticsearch 图像不是 Ubuntu 基于的。
Docker 不是模拟内核,而是在每个容器中使用(已经 运行)主机系统的内核,因此每个容器中的内核信息将是内核信息主机的。您的主机是 Ubuntu,但图像不是。
在基于此图像的 ubuntu docker 容器内:
docker.elastic.co/elasticsearch/elasticsearch:7.7.0
我正在尝试 运行 apt-get install
(是的,我知道我应该从 docker 文件构建一个新图像,但仍在尝试理解它失败的原因)但是得到以下错误:
# 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
return Ubuntu SMP
?
elasticsearch 图像不是 Ubuntu 基于的。
Docker 不是模拟内核,而是在每个容器中使用(已经 运行)主机系统的内核,因此每个容器中的内核信息将是内核信息主机的。您的主机是 Ubuntu,但图像不是。