Skip to content

docker / nerdctl inconsistent value type for Labels returned by container list --format json #2987

@apostasie

Description

@apostasie

Description

docker returns Labels as a string with coma separated key=value, while nerdctl return them as an object.

I appreciate that nerdctl wants to mimic docker behavior as much as possible and I am usually on board with that, but in that case, I think Docker is just wrong and nerdctl should keep the current behavior, even at the cost of deviating.

I am opening the issue so that we can have a discussion on this and decide on a resolution.

My vote obviously is to just document it and not change the current behavior.

Thoughts?

Steps to reproduce the issue

  1. docker container list --all --format json
  2. sudo ./nerdctl container list --all --format json

Describe the results you received and expected

Docker returns:

{
  "Labels": "org.opencontainers.image.version=f40ece5,org.opencontainers.image.documentation=https://github.com/dubo-dubon-duponey/docker-dns/blob/master/README.md,org.opencontainers.image.ref.name=bookworm-2024-03-01,org.opencontainers.image.revision=f40ece567f4d6a0b1c8249f32ab0a82f5594efca,org.opencontainers.image.created=2024-03-27T12:15:26-0700,org.opencontainers.image.licenses=The MIT License (MIT),org.opencontainers.image.source=https://github.com/dubo-dubon-duponey/docker-dns/tree/master,org.opencontainers.image.vendor=dubodubonduponey,org.hadron.core.version=v0.1-dev,org.hadron.plan.tag=2024/04/02-17:19:16-5F6228B8-4152-4C7B-8D44-4E9293B1C59D,org.hadron.plan.sha=3c8d9485ffe7f0c91b837942b98be71d3d65a632029ae579143387eda499a137,org.opencontainers.image.authors=Dubo Dubon Duponey <dubo-dubon-duponey@farcloser.world>,org.opencontainers.image.description=So image. Much DBDBDP. Such description.,org.opencontainers.image.title=A DBDBDP image,org.opencontainers.image.url=https://github.com/dubo-dubon-duponey/docker-dns,org.hadron.plan.description=some_plan_descriptor,org.hadron.plan.name=plan_name"
}

Nerdctl returns:

  "Labels": {
    "containerd.io/restart.loguri": "binary:///home/apo/nerdctl-patch?_NERDCTL_INTERNAL_LOGGING=%2Fvar%2Flib%2Fnerdctl%2F1935db59",
    "containerd.io/restart.policy": "always",
    "containerd.io/restart.status": "running",
    "io.containerd.image.config.stop-signal": "SIGTERM",
    "nerdctl/extraHosts": "null",
    "nerdctl/hostname": "airplay-oliphant.local",
    "nerdctl/ipc": "{\"mode\":\"private\"}",
    "nerdctl/log-uri": "binary:///home/apo/nerdctl-patch?_NERDCTL_INTERNAL_LOGGING=%2Fvar%2Flib%2Fnerdctl%2F1935db59",
    "nerdctl/mounts": "[{\"Type\":\"tmpfs\",\"Source\":\"tmpfs\",\"Destination\":\"/magnetar/cache\",\"Mode\":\"nodev,rw,uid=2000,gid=65534,noexec,nosuid,size=1000000000\",\"RW\":false,\"Propagation\":\"\"},{\"Type\":\"tmpfs\",\"Source\":\"tmpfs\",\"Destination\":\"/magnetar/runtime\",\"Mode\":\"nodev,rw,uid=2000,gid=65534,noexec,nosuid,size=1000000\",\"RW\":false,\"Propagation\":\"\"},{\"Type\":\"tmpfs\",\"Source\":\"tmpfs\",\"Destination\":\"/magnetar/state\",\"Mode\":\"nodev,rw,uid=2000,gid=65534,noexec,nosuid,size=1000000\",\"RW\":false,\"Propagation\":\"\"},{\"Type\":\"tmpfs\",\"Source\":\"tmpfs\",\"Destination\":\"/magnetar/state/avahi-daemon\",\"Mode\":\"nodev,rw,uid=101,gid=102,noexec,nosuid,size=1000000\",\"RW\":false,\"Propagation\":\"\"}]",
    "nerdctl/name": "airplay",
    "nerdctl/namespace": "default",
    "nerdctl/networks": "[\"hadron-mac-v6\"]",
    "nerdctl/platform": "linux/arm64/v8",
    "nerdctl/state-dir": "/var/lib/nerdctl/1935db59/containers/default/4b9798381227e513e01d08eb646ab336c6eb967e1a22f484b51e437d6a5c3cf0",
    "org.hadron.core.version": "v0.1-dev",
    "org.hadron.plan.description": "some_plan_descriptor",
    "org.hadron.plan.name": "plan_name",
    "org.hadron.plan.sha": "4c4179622ab1571d55d5eed32c5ac9bde46756197ba47d597f7f61e5d36ad742",
    "org.hadron.plan.tag": "2024/05/10-23:53:16-010DA0DA-FDA3-4C2A-A67D-35CB9FCB2F88"
  }

What version of nerdctl are you using?

1.7.6

Are you using a variant of nerdctl? (e.g., Rancher Desktop)

None

Host information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions