export def get_image_digest [image: string] { let token = ( get_token $image ) mut headers = ( [] | append [Accept "application/vnd.docker.distribution.manifest.v2+json"] | append [Authorization $"Bearer ($token)"] ) print $headers ( http get -H $headers $"https://registry.hub.docker.com/v2/($image)/manifests/latest" | from json | get config | get digest | split row ":" | get 1 ) } def get_token [image: string] { http get $"https://auth.docker.io/token?scope=repository:($image):pull&service=registry.docker.io" | get token }