是否可以从 运行 Google Container-Optimized OS 中提取内部版本号?

Is it possible to pull the build number from a running Google Container-Optimized OS?

根据 this page,可以从 Google Cloud Storage 中的以下位置提取内核源。

gs://cos-tools/<build-number>/

我正在尝试查找 Container-Optimized OS 的 运行 实例的源代码,但我没有找到描述如何从 运行 中提取内部版本号的文档] 实例。 uname -r 的输出是 4.4.111+ 但我不知道如何将其映射到可用于拉取源代码的内部版本号。

如何找到内部版本号?

在 运行 COS 实例中,您可以在 /etc/lsb-release.

中找到版本
$ cat /etc/lsb-release | grep CHROMEOS_RELEASE_VERSION
CHROMEOS_RELEASE_VERSION=10452.101.0

然后,在安装并配置了gsutil的机器上

$ gsutil ls gs://cos-tools/10452.101.0/
gs://cos-tools/10452.101.0/kernel-src.tar.gz
gs://cos-tools/10452.101.0/kernel-src.tar.gz.md5

最好的方法是查看 /etc/os-release:

$ cat /etc/os-release | grep BUILD_ID
BUILD_ID=12607.7.0

参见 this Chromium OS design doc for more details of the meaning of all the fields in /etc/lsb-release and /etc/os-release in Chromium OS, and whether you can rely on it or not. Container-optimized OS is based on Chromium OS。