@@ -466,18 +466,23 @@ export async function updateRemoteUserUID(params: DockerResolverParameters, merg
466466 const inspectResult = await dockerCLI ( params , 'inspect' , '--type' , 'image' , imageName ) ;
467467 const inspectJson = inspectResult . stdout . toString ( ) . trim ( ) ;
468468 output . write ( `updateUID: docker inspect ${ imageName } : ${ inspectJson } ` , LogLevel . Info ) ;
469- // Read the raw manifest list from the containerd content store using the image digest
469+ // Extract the OCI index from docker save to see manifest list platform annotations
470470 try {
471471 const parsed = JSON . parse ( inspectJson ) ;
472- const digest = parsed [ 0 ] ?. Id || parsed [ 0 ] ?. Descriptor ?. digest ;
472+ const digest = parsed [ 0 ] ?. Descriptor ?. digest ;
473473 if ( digest ) {
474- const hash = digest . replace ( 'sha256:' , '' ) ;
475- const blobPath = `/var/lib/docker/containerd/daemon/io.containerd.content.v1.content/blobs/sha256/${ hash } ` ;
476- const catResult = await runCommandNoPty ( { exec : common . cliHost . exec , cmd : 'cat' , args : [ blobPath ] , output : nullLog } ) ;
477- output . write ( `updateUID: manifest list (${ blobPath } ): ${ catResult . stdout . toString ( ) . trim ( ) } ` , LogLevel . Info ) ;
474+ const hash = digest . replace ( 'sha256:' , '' ) . replace ( ':' , '/' ) ;
475+ // docker save outputs OCI layout; extract the manifest list blob by digest
476+ const saveResult = await runCommandNoPty ( {
477+ exec : common . cliHost . exec ,
478+ cmd : '/bin/sh' ,
479+ args : [ '-c' , `docker save ${ imageName } | tar -xO blobs/sha256/${ hash } 2>/dev/null || docker save ${ imageName } | tar -xO index.json 2>/dev/null` ] ,
480+ output : nullLog
481+ } ) ;
482+ output . write ( `updateUID: manifest list for ${ imageName } : ${ saveResult . stdout . toString ( ) . trim ( ) } ` , LogLevel . Info ) ;
478483 }
479484 } catch ( blobErr ) {
480- output . write ( `updateUID: reading manifest list blob failed: ${ blobErr instanceof Error ? blobErr . message : JSON . stringify ( blobErr ) } ` , LogLevel . Warning ) ;
485+ output . write ( `updateUID: reading manifest list failed: ${ blobErr instanceof Error ? blobErr . message : JSON . stringify ( blobErr ) } ` , LogLevel . Warning ) ;
481486 }
482487 } catch ( err ) {
483488 output . write ( `updateUID: docker inspect failed: ${ err } ` , LogLevel . Warning ) ;
0 commit comments