u123
u123

Reputation: 16287

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

Inside an ubuntu docker container based on this image:

docker.elastic.co/elasticsearch/elasticsearch:7.7.0

I am trying to run apt-get install (yes I am aware I should build a new image from a dockerfile but still trying to understand why it fails) but get the below error:

# 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

From what I can see the above is ubuntu so whats up with bash: apt-get: command not found?

UPDATE:

Its CentOS:

# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"

So it works with:

yum install openssl

But why does

# 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?

Upvotes: 1

Views: 3546

Answers (1)

Andruida
Andruida

Reputation: 384

The elasticsearch image isn't Ubuntu based.

Docker isn't emulating a kernel, instead it uses the (already running) kernel of the host system in every container, so the kernel information in every container will be the kernel information of the host. Your host is Ubuntu, but the image isn't.

Upvotes: 2

Related Questions