Skip to content

compat: Add DNSNames to GET /containers/{name:.*}/json - #29349

Closed
simek-m wants to merge 1 commit into
podman-container-tools:mainfrom
simek-m:RUN-3314-compat-dnsnames
Closed

compat: Add DNSNames to GET /containers/{name:.*}/json#29349
simek-m wants to merge 1 commit into
podman-container-tools:mainfrom
simek-m:RUN-3314-compat-dnsnames

Conversation

@simek-m

@simek-m simek-m commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Docker Engine API v1.44 introduces a new field named DNSNames containing all non-fully qualified DNS names a container takes on a specific network for the GET /containers/{name:.*}/json endpoint.

  • Populate DNSNames for the compat endpoints GET /containers/json and GET /containers/{name:.*}/json (the Docker changelog mentions only /containers/{name:.*}/json, but it's the same moby structure).
  • Add the DNSNames field to GET /libpod/containers/json (added to entities.ListContainer) too based on RUN-3314 description - works with podman list/ps --format '{{.DNSNames}}'

Fixes: https://redhat.atlassian.net/browse/RUN-3314

Checklist

Ensure you have completed the following checklist for your pull request to be reviewed:

  • I have read and understood our contributing guidelines and will not have more than two open PRs as a new contributor.
  • PR description, commit message, and GitHub comments are human-written, per LLM Policy
  • Certify you wrote the patch or otherwise have the right to pass it on as an open-source patch by signing all
    commits. (git commit -s). (If needed, use git commit -s --amend). The author email must match
    the sign-off email address. See CONTRIBUTING.md
    for more information.
  • Referenced issues using Fixes: #00000 in commit message (if applicable)
  • Tests have been added/updated (or no tests are needed)
  • Documentation has been updated (or no documentation changes are needed)
  • All commits pass make validatepr (format/lint checks)
  • Release note entered in the section below (or None if no user-facing changes)

Does this PR introduce a user-facing change?

Add field DNSNames to the compat endpoints GET /containers/json and GET /containers/{name:.*}/json and to the libpod endpoint GET /libpod/containers/json.

Example output

➜ curl -s http://localhost:8080/v1.44/containers/dnstest/json | jq '.NetworkSettings'
{
  "SandboxID": "",
  "SandboxKey": "/run/netns/netns-a3fa06b8-40a8-b0e7-10ab-c2d73127538f",
  "Ports": {},
  "Networks": {
    "podman": {
      "IPAMConfig": null,
      "Links": null,
      "Aliases": [
        "844f6d6ce177"
      ],
      "DriverOpts": null,
      "GwPriority": 0,
      "NetworkID": "2f259bab93aaaaa2542ba43ef33eb990d0999ee1b9924b557b7be53c0b7a1bb9",
      "EndpointID": "",
      "Gateway": "10.88.0.1",
      "IPAddress": "10.88.0.186",
      "MacAddress": "ee:76:15:30:c1:7d",
      "IPPrefixLen": 16,
      "IPv6Gateway": "",
      "GlobalIPv6Address": "",
      "GlobalIPv6PrefixLen": 0,
      "DNSNames": [
        "dnstest",
        "844f6d6ce177"
      ]
    }
  }
}
➜  podman git:(main) ✗ curl -s http://localhost:8080/v1.44/containers/json | jq '.[].NetworkSettings'
{
  "Networks": {
    "podman": {
      "IPAMConfig": null,
      "Links": null,
      "Aliases": [
        "844f6d6ce177"
      ],
      "DriverOpts": null,
      "GwPriority": 0,
      "NetworkID": "2f259bab93aaaaa2542ba43ef33eb990d0999ee1b9924b557b7be53c0b7a1bb9",
      "EndpointID": "",
      "Gateway": "10.88.0.1",
      "IPAddress": "10.88.0.186",
      "MacAddress": "ee:76:15:30:c1:7d",
      "IPPrefixLen": 16,
      "IPv6Gateway": "",
      "GlobalIPv6Address": "",
      "GlobalIPv6PrefixLen": 0,
      "DNSNames": [
        "dnstest",
        "844f6d6ce177"
      ]
    }
  }
}
➜  curl -s http://localhost:8080/v6.0.0/libpod/containers/json | jq .
[
  {
    "AutoRemove": false,
    "Command": [
      "top"
    ],
    "Created": "2026-07-30T14:26:23.637667619+02:00",
    "CreatedAt": "",
    "CIDFile": "",
    "Exited": false,
    "ExitedAt": -62135596800,
    "ExitCode": 0,
    "ExposedPorts": null,
    "Id": "844f6d6ce177a4d5d89aba9849b246e9ca7fa26d6e2c468eee988ad56d2cca88",
    "Image": "docker.io/library/alpine:latest",
    "ImageID": "1991bd789d7184290c3cce84fd6af068b8b745e9bddf178661ce7f5ecf68135c",
    "IsInfra": false,
    "Labels": null,
    "Mounts": [],
    "Names": [
      "dnstest"
    ],
    "Namespaces": {},
    "Networks": [
      "podman"
    ],
    "DNSNames": {
      "podman": [
        "dnstest",
        "844f6d6ce177"
      ]
    },
    "Pid": 366232,
    "Pod": "",
    "PodName": "",
    "Ports": null,
    "Restarts": 0,
    "Size": null,
    "StartedAt": 1785414383,
    "State": "running",
    "Status": ""
  }
]

@github-actions github-actions Bot added the kind/api-change Change to remote API; merits scrutiny label Jul 30, 2026
Docker Engine API v1.44 introduces a new field named
DNSNames containing all non-fully qualified DNS
names a container takes on a specific network for
the GET /containers/{name:.*}/json endpoint.

Populate DNSNames for the compat endpoints GET /containers/json
and GET /containers/{name:.*}/json.

Add the DNSNames field to GET /libpod/containers/json
(added to entities.ListContainer) too.

Fixes: https://redhat.atlassian.net/browse/RUN-3314
Signed-off-by: Marek Simek <msimek@redhat.com>
@simek-m
simek-m force-pushed the RUN-3314-compat-dnsnames branch from edeab29 to e4468b1 Compare July 30, 2026 15:43
@simek-m

simek-m commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author
xref-helpmsgs-manpages: 'podman container list --format {{.DNSNames' is a nested structure. Please add '...' to man page.
xref-helpmsgs-manpages: 'podman container ps --format {{.DNSNames' is a nested structure. Please add '...' to man page.
xref-helpmsgs-manpages: 'podman ps --format {{.DNSNames' is a nested structure. Please add '...' to man page.
make: *** [Makefile:632: xref-helpmsgs-manpages] Error 1

Oh, I'll fix this.

@Luap99

Luap99 commented Jul 30, 2026

Copy link
Copy Markdown
Member

I have not really looked at the details here but I already reviewed #29227 from @ashley-cui. Can you cross check that, which version is needed?

@simek-m

simek-m commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

I have not really looked at the details here but I already reviewed #29227 from @ashley-cui. Can you cross check that, which version is needed?

Oh, thank you. I knew that v1.45 mentions:

The Aliases field returned in calls to GET /containers/{name:.*}/json no longer contains the short container ID, but instead will reflect exactly the values originally submitted to the POST /containers/create endpoint. The newly introduced DNSNames should now be used instead when short container IDs are needed.

but unfortunately completely missed that Ashley did this one too:(
It's a bit chaotic working on multiple versions in parallel (some changelogs were implemented from even higher versions than v1.45, but there are some missing parts from versions below 1.44 according to Nicola).

Well, at least I've learnt a bit about networking. I implemented it a bit differently and Ashley's version has much better tests. I'll comment there.

@simek-m
simek-m marked this pull request as draft July 31, 2026 08:38
@simek-m

simek-m commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of #29227

@simek-m simek-m closed this Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/api-change Change to remote API; merits scrutiny

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants