在不同图像上检查 uname 的 Concourse 任务

Concourse tasks that check uname on different images

来自Stark Concourse tutorial

以下任务将 运行 带有 -a 开关的 uname 命令打开标记为 "14.04"docker-image:

---
platform: linux

image_resource:
  type: docker-image
  source: {repository: ubuntu, tag: "14.04"}

run:
  path: uname
  args: [-a]

结果:

fly -t tutorial e -c task_ubuntu_uname.yml
executing build 10
initializing
running uname -a
Linux a0c3f38b-7dd3-4a8f-7b3e-e56ce2bf05e9 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
succeeded

我很好奇为什么更改标签不会更改 Ubuntu 的版本:

---
platform: linux

image_resource:
  type: docker-image
  source: {repository: ubuntu, tag: "16.04"}

run:
  path: uname
  args: [-a]

结果:

fly -t tutorial e -c task_ubuntu_16_uname.yml
executing build 9
initializing
running uname -a
Linux 58069086-7a27-43f8-71ff-374bcaef0c6d 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
succeeded

我看到 guid 不同,但我希望版本也不同。为什么版本不是 16.04?

uname 将获取您 运行 正在使用的机器的主机内核的版本信息 - 这没有命名空间 - 所以您 运行 正在使用的容器不会运行显示。

如果您在 ubuntu 主机上,并且 运行 docker run --rm -it centos uname -a,它仍将显示 ubuntu 内核结果。