【问题标题】:bash: apt-get: command not found (on ubuntu docker image)bash:apt-get:找不到命令(在 ubuntu docker 映像上)
【发布时间】:2020-06-05 02:00:23
【问题描述】:

在基于此图像的 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?

【问题讨论】:

  • 你使用的是哪个 ubuntu 镜像?我无法使用 Docker for Mac 和最新的 ubuntu 映像 sha256:1d622ef86b138c7e96d4f797bf5e4baca3249f030c575b9337638594f2b63f01 重现此问题
  • 请分享你的 Dockerfle
  • uname 表示您的主机正在运行 Ubuntu 构建的内核,但根本没有说明映像正在使用什么包管理器或分发(如果有)。

标签: docker ubuntu apt-get


【解决方案1】:

elasticsearch 映像不是基于 Ubuntu。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-15
    • 2022-07-26
    • 2015-02-20
    • 1970-01-01
    • 2022-01-04
    • 1970-01-01
    • 2020-02-12
    • 1970-01-01
    相关资源
    最近更新 更多