Skip to content

Cannot get network info from container when using hyphens in network name #22449

Answered by Luap99
oSourceSE asked this question in Q&A
Discussion options

You must be logged in to vote

This is not the correct syntax to access map keys, the go template cannot handle the hyphens
see this for the proper syntax:

run_podman inspect $cid --format "{{(index .NetworkSettings.Networks \"$netname\").IPAddress}}"

also see https://pkg.go.dev/text/template for the official go docs on template syntax

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@oSourceSE
Comment options

Answer selected by oSourceSE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #22448 on April 20, 2024 12:21.