Skip to content

Commit

Permalink
Ensure nerdctl can run after docker.
Browse files Browse the repository at this point in the history
A bug in the nerdctl client expects to see an `auths` entry for
`https://index.docker.io/v1/` in `~/.docker/config.json` even
when we're getting the credentials from the `credsStore` field.

This is a workaround for upstream PR containerd/nerdctl#1315

Signed-off-by: Eric Promislow <epromislow@suse.com>
  • Loading branch information
ericpromislow committed Aug 16, 2022
1 parent c64aa16 commit bb5f69d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/backend/lima.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1944,6 +1944,12 @@ CREDFWD_URL='http://${ hostIPAddr }:${ stateInfo.port }'
existingConfig = {};
}
merge(existingConfig, defaultConfig);
if (this.cfg?.containerEngine === ContainerEngine.CONTAINERD) {
const fixedConfig = { auths: { 'https://index.docker.io/v1/': {} } };

merge(fixedConfig, existingConfig);
existingConfig = fixedConfig;
}
await this.writeFile(ROOT_DOCKER_CONFIG_PATH, jsonStringifyWithWhiteSpace(existingConfig), 0o644);
} catch (err: any) {
console.log('Error trying to create/update docker credential files:', err);
Expand Down
6 changes: 6 additions & 0 deletions src/backend/wsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,12 @@ export default class WSLBackend extends events.EventEmitter implements K8s.Kuber
existingConfig = {};
}
_.merge(existingConfig, defaultConfig);
if (this.cfg?.containerEngine === ContainerEngine.CONTAINERD) {
const fixedConfig = { auths: { 'https://index.docker.io/v1/': {} } };

_.merge(fixedConfig, existingConfig);
existingConfig = fixedConfig;
}
await this.writeFile(ROOT_DOCKER_CONFIG_PATH, jsonStringifyWithWhiteSpace(existingConfig), { permissions: 0o644 });
} catch (err: any) {
console.log('Error trying to create/update docker credential files:', err);
Expand Down

0 comments on commit bb5f69d

Please sign in to comment.