问题原文
原帖链接 · g.pickardou · CC BY-SA 4.0
I execute cat /etc/os-release in a container.
I have an Ubuntu 22.04 docker host. When I run a container, and see the linux os-release file inside the container, I see my Ubuntu name, regardless in which container I execute it...
However I also have an other Kubernetes cluster also on Ubuntu 22.04 (no docker, the cluster configured to use containerd directly). If I create a deployment based on any image, when I see the os-release file, I see an image specific linux name, which clearly comes from the image itself, sometime alpine, sometime bookworm, etc.
Why is this different behavior?
社区高分解答
原帖链接 · Quantim · CC BY-SA 4.0
The /etc/os-release file is based on the container base image, if you get same version as your host, it only means you run images based on Ubuntu 22.04
You can test it with the container based on different system
Example from my machine running on Ubuntu, first command from host, second from container
$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.2 LTS"
...
$ docker run --rm -ti node:16 bash
root@3d48cdfe1d97:/# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
..
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
