Skip to content

Existing container labels defined in the Dockerfile are ignored by containerd #5938

@ahmed-mez

Description

@ahmed-mez

Description

Containerd clears container labels defined in the Dockerfile. Perhaps because the container run and create commands call WithContainerLabels instead of WithAdditionalContainerLabels ?

Surfacing containers metadata is crucial for monitoring. In particular, container labels that are defined at build time.
Any plans to change this behavior?

Thanks!

Steps to reproduce the issue:

  1. Build an image with this Dockerfile: docker build -t <org>/redis:withlabel .
FROM redis
LABEL key=val
  1. ctr run <org>/redis:withlabel <id>
  2. ctr container info <id>

Describe the results you received:

    "Labels": {
        "io.containerd.image.config.stop-signal": "SIGTERM"
    },

Describe the results you expected:

    "Labels": {
        "io.containerd.image.config.stop-signal": "SIGTERM",
         "key": "val"
    },

What version of containerd are you using:

$ containerd --version
containerd github.com/containerd/containerd v1.2.13 7ad184331fa3e55e52b890ea95e65ba581ae3429

Any other relevant information (runC version, CRI configuration, OS/Kernel version, etc.):

runc --version
$ runc --version
runc version 1.0.0-rc10
commit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
spec: 1.0.1-dev
crictl info
$ crictl info
{
  "status": {
    "conditions": [
      {
        "type": "RuntimeReady",
        "status": true,
        "reason": "",
        "message": ""
      },
      {
        "type": "NetworkReady",
        "status": true,
        "reason": "",
        "message": ""
      }
    ]
  },
  "config": {
    "containerd": {
      "snapshotter": "overlayfs",
      "defaultRuntime": {
        "runtimeType": "io.containerd.runtime.v1.linux",
        "runtimeEngine": "",
        "runtimeRoot": "",
        "options": null
      },
      "untrustedWorkloadRuntime": {
        "runtimeType": "",
        "runtimeEngine": "",
        "runtimeRoot": "",
        "options": null
      },
      "runtimes": null,
      "noPivot": true
    },
    "cni": {
      "binDir": "/opt/cni/bin",
      "confDir": "/etc/cni/net.d",
      "confTemplate": ""
    },
    "registry": {
      "mirrors": {
        "docker.io": {
          "endpoint": [
            "https://registry-1.docker.io"
          ]
        }
      },
      "auths": null
    },
    "streamServerAddress": "",
    "streamServerPort": "10010",
    "enableSelinux": false,
    "sandboxImage": "k8s.gcr.io/pause:3.2",
    "statsCollectPeriod": 10,
    "systemdCgroup": false,
    "enableTLSStreaming": false,
    "x509KeyPairStreaming": {
      "tlsCertFile": "",
      "tlsKeyFile": ""
    },
    "maxContainerLogSize": 16384,
    "disableProcMount": false,
    "containerdRootDir": "/mnt/sda1/var/lib/containerd",
    "containerdEndpoint": "/run/containerd/containerd.sock",
    "rootDir": "/mnt/sda1/var/lib/containerd/io.containerd.grpc.v1.cri",
    "stateDir": "/run/containerd/io.containerd.grpc.v1.cri"
  },
  "golang": "go1.11.13"
}
uname -a
$ uname -a
Linux minikube 4.19.107 #1 SMP Thu Mar 26 11:33:10 PDT 2020 x86_64 GNU/Linux

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions