Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
apostasie opened this issue May 11, 2024 · 3 comments · Fixed by #3058
Closed
Labels
bug Something isn't working
Milestone

Comments

@apostasie
Copy link
Contributor

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 <[email protected]>,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

@apostasie apostasie added the kind/unconfirmed-bug-claim Unconfirmed bug claim label May 11, 2024
@apostasie
Copy link
Contributor Author

Interestingly, sudo /home/apo/nerdctl network list --format json does have the same behavior as docker (return serialized labels).

I would argue that we at least need to be consistent between commands.

@apostasie
Copy link
Contributor Author

Also, more generally, the output of that command is varying a lot between docker and nerdctl ("State", "Status" have different syntax and some keys are present in one but not the other).

If consistency with Docker is required on this command, there is a lot of work to get it there.

@AkihiroSuda
Copy link
Member

Thanks for reporting, it should follow Docker's behavior, although Docker seems weird in this case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants