@@ -7,7 +7,7 @@ import * as path from 'path';
77
88import { DevContainerConfig } from '../spec-configuration/configuration' ;
99import { dockerCLI , dockerPtyCLI , ImageDetails , toExecParameters , toPtyExecParameters } from '../spec-shutdown/dockerUtils' ;
10- import { LogLevel , makeLog } from '../spec-utils/log' ;
10+ import { LogLevel , makeLog , nullLog } from '../spec-utils/log' ;
1111import { FeaturesConfig , getContainerFeaturesBaseDockerFile , getFeatureInstallWrapperScript , getFeatureLayers , getFeatureMainValue , getFeatureValueObject , generateFeaturesConfig , Feature , generateContainerEnvs } from '../spec-configuration/containerFeaturesConfiguration' ;
1212import { readLocalFile } from '../spec-utils/pfs' ;
1313import { includeAllConfiguredFeatures } from '../spec-utils/product' ;
@@ -464,16 +464,24 @@ export async function updateRemoteUserUID(params: DockerResolverParameters, merg
464464 }
465465 try {
466466 const inspectResult = await dockerCLI ( params , 'inspect' , '--type' , 'image' , imageName ) ;
467- output . write ( `updateUID: docker inspect ${ imageName } : ${ inspectResult . stdout . toString ( ) . trim ( ) } ` , LogLevel . Info ) ;
467+ const inspectJson = inspectResult . stdout . toString ( ) . trim ( ) ;
468+ output . write ( `updateUID: docker inspect ${ imageName } : ${ inspectJson } ` , LogLevel . Info ) ;
469+ // Read the raw manifest list from the containerd content store using the image digest
470+ try {
471+ const parsed = JSON . parse ( inspectJson ) ;
472+ const digest = parsed [ 0 ] ?. Id || parsed [ 0 ] ?. Descriptor ?. digest ;
473+ 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 ) ;
478+ }
479+ } catch ( blobErr ) {
480+ output . write ( `updateUID: reading manifest list blob failed: ${ blobErr instanceof Error ? blobErr . message : JSON . stringify ( blobErr ) } ` , LogLevel . Warning ) ;
481+ }
468482 } catch ( err ) {
469483 output . write ( `updateUID: docker inspect failed: ${ err } ` , LogLevel . Warning ) ;
470484 }
471- try {
472- const imagetoolsResult = await dockerCLI ( params , 'buildx' , 'imagetools' , 'inspect' , imageName , '--raw' ) ;
473- output . write ( `updateUID: docker buildx imagetools inspect ${ imageName } : ${ imagetoolsResult . stdout . toString ( ) . trim ( ) } ` , LogLevel . Info ) ;
474- } catch ( err ) {
475- output . write ( `updateUID: docker buildx imagetools inspect failed: ${ err instanceof Error ? err . message : JSON . stringify ( err ) } ` , LogLevel . Warning ) ;
476- }
477485
478486 const dockerfileName = 'updateUID.Dockerfile' ;
479487 const srcDockerfile = path . join ( common . extensionPath , 'scripts' , dockerfileName ) ;
0 commit comments