Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Notable changes.

## February 2026

### [0.83.2]
- Improved logging for image inspect errors. (https://github.com/devcontainers/cli/pull/1152)

### [0.83.1]
- Bump tar from 7.5.6 to 7.5.7. (https://github.com/devcontainers/cli/pull/1140)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@devcontainers/cli",
"description": "Dev Containers CLI",
"version": "0.83.1",
"version": "0.83.2",
"bin": {
"devcontainer": "devcontainer.js"
},
Expand Down
42 changes: 28 additions & 14 deletions src/spec-node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,28 +243,42 @@ export function isBuildKitImagePolicyError(err: any): boolean {
export async function inspectDockerImage(params: DockerResolverParameters | DockerCLIParameters, imageName: string, pullImageOnError: boolean) {
try {
return await inspectImage(params, imageName);
} catch (err) {
} catch (inspectErr) {
const output = 'cliHost' in params ? params.output : params.common.output;
if (!pullImageOnError) {
throw err;
logErrorStdoutStderr(inspectErr, output);
throw inspectErr;
}
const output = 'cliHost' in params ? params.output : params.common.output;
try {
return await inspectImageInRegistry(output, params.platformInfo, imageName);
} catch (err2) {
output.write(`Error fetching image details: ${err2?.message}`);
} catch (inspectErr2) {
output.write(`Error fetching image details: ${inspectErr2?.message}`, LogLevel.Info);
}
try {
await retry(async () => dockerPtyCLI(params, 'pull', imageName), { maxRetries: 5, retryIntervalMilliseconds: 1000, output });
} catch (_err) {
if (err.stdout) {
output.write(err.stdout.toString());
}
if (err.stderr) {
output.write(toErrorText(err.stderr.toString()));
}
throw err;
} catch (pullErr) {
logErrorStdoutStderr(inspectErr, output);
logErrorStdoutStderr(pullErr, output);
throw pullErr;
}
try {
return await inspectImage(params, imageName);
} catch (inspectErr3) {
logErrorStdoutStderr(inspectErr3, output);
throw inspectErr3;
}
return inspectImage(params, imageName);
}
}

function logErrorStdoutStderr(err: any, output: Log) {
if (err?.message) {
output.write(err.message, LogLevel.Error);
}
if (err?.stdout) {
output.write(err.stdout.toString(), LogLevel.Error);
}
if (err?.stderr) {
output.write(toErrorText(err.stderr.toString()), LogLevel.Error);
}
}

Expand Down
Loading