Skip to content

Commit 8afbc9c

Browse files
committed
fix: default to legacy builder instead of BuildKit with podman
- Podman doesn't support all buildkit features. - Podman main branch is now always defaulting to "DOCKER_BUILDKIT=0", See https://github.com/containers/podman/blob/f7be7a365ad3e90db5f96f269a555f6f380f9275/cmd/podman/compose.go#L164 - fix: make cli ignore `--buildkit` parameter and default to `never` when Podman is used.
1 parent f475b2b commit 8afbc9c

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/spec-node/devContainers.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { createNullLifecycleHook, finishBackgroundTasks, ResolverParameters, Use
1313
import { GoARCH, GoOS, getCLIHost, loadNativeModule } from '../spec-common/commonUtils';
1414
import { resolve } from './configContainer';
1515
import { URI } from 'vscode-uri';
16-
import { LogLevel, LogDimensions, toErrorText, createCombinedLog, createTerminalLog, Log, makeLog, LogFormat, createJSONLog, createPlainLog, LogHandler, replaceAllLog } from '../spec-utils/log';
16+
import { LogLevel, LogDimensions, toErrorText, toWarningText, createCombinedLog, createTerminalLog, Log, makeLog, LogFormat, createJSONLog, createPlainLog, LogHandler, replaceAllLog } from '../spec-utils/log';
1717
import { dockerComposeCLIConfig } from './dockerCompose';
1818
import { Mount } from '../spec-configuration/containerFeaturesConfiguration';
1919
import { getPackageConfig, PackageConfiguration } from '../spec-utils/product';
@@ -197,14 +197,18 @@ export async function createDockerParams(options: ProvisionOptions, disposables:
197197
}
198198
})();
199199

200-
const buildKitVersion = options.useBuildKit === 'never' ? undefined : (await dockerBuildKitVersion({
201-
cliHost,
202-
dockerCLI: dockerPath,
203-
dockerComposeCLI,
204-
env: cliHost.env,
205-
output,
206-
platformInfo
207-
}));
200+
const buildKitVersion = async () => {
201+
if (options.useBuildKit === 'never') {
202+
return undefined;
203+
} else {
204+
if (await isPodman({ exec: cliHost.exec, cmd: dockerPath, env: cliHost.env, output })) {
205+
output.write(toWarningText('Podman does not support BuildKit, defaulting to legacy builder.'));
206+
return undefined;
207+
}
208+
return await dockerBuildKitVersion({ cliHost, dockerCLI: dockerPath, dockerComposeCLI, env: cliHost.env, output, platformInfo });
209+
}
210+
};
211+
208212
return {
209213
common,
210214
parsedAuthority,
@@ -224,7 +228,7 @@ export async function createDockerParams(options: ProvisionOptions, disposables:
224228
userRepositoryConfigurationPaths: [],
225229
updateRemoteUserUIDDefault,
226230
additionalCacheFroms: options.additionalCacheFroms,
227-
buildKitVersion,
231+
buildKitVersion: await buildKitVersion(),
228232
isTTY: process.stdout.isTTY || options.logFormat === 'json',
229233
experimentalLockfile,
230234
experimentalFrozenLockfile,

0 commit comments

Comments
 (0)