最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Extract "packages" key from skopeo output with jq - Stack Overflow

programmeradmin5浏览0评论

I'm trying to extract the list of packages from skopeo inspect output, but this does not seem to work:

❯ skopeo inspect docker://ghcr.io/ublue-os/bluefin-dx:gts | jq '.Labels."dev.hhd.rechunk.info".packages'

The above works without the ".packages" part and the content is:

❯ skopeo inspect docker://ghcr.io/ublue-os/bluefin-dx:gts | jq '.Labels."dev.hhd.rechunk.info"'
"{\"version\": 2, \"uniq\": \"gts-40.20250305\", \"packages\": {\"libgcc\": \"14.2.1-3.fc40\", .....

How can I ask jq to go into this object and extract just the "packages" part?

I'm trying to extract the list of packages from skopeo inspect output, but this does not seem to work:

❯ skopeo inspect docker://ghcr.io/ublue-os/bluefin-dx:gts | jq '.Labels."dev.hhd.rechunk.info".packages'

The above works without the ".packages" part and the content is:

❯ skopeo inspect docker://ghcr.io/ublue-os/bluefin-dx:gts | jq '.Labels."dev.hhd.rechunk.info"'
"{\"version\": 2, \"uniq\": \"gts-40.20250305\", \"packages\": {\"libgcc\": \"14.2.1-3.fc40\", .....

How can I ask jq to go into this object and extract just the "packages" part?

Share Improve this question asked Mar 8 at 10:19 AlexandrosAlexandros 2,2491 gold badge21 silver badges32 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Use fromjson to parse json text:

$ skopeo inspect docker://ghcr.io/ublue-os/bluefin-dx:gts | jq '.Labels."dev.hhd.rechunk.info" | fromjson.packages'
{
  "libgcc": "14.2.1-3.fc40"
}
发布评论

评论列表(0)

  1. 暂无评论