mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-05-24 11:24:18 +00:00
Do not pass auth to images with no registry
The supervisor allows the target image to be an image without a registry (e.g. `alpine:latest`), while this really only happens while in local mode, we don't want to pass credentials to the default registry as those credentials are meant for balena registry and will otherwise fail. Change-type: patch
This commit is contained in:
parent
d3be730c8e
commit
c1207cbbff
@ -247,13 +247,18 @@ export async function fetchImageWithProgress(
|
|||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const { registry } = await dockerToolbelt.getRegistryAndName(image);
|
const { registry } = await dockerToolbelt.getRegistryAndName(image);
|
||||||
|
|
||||||
const dockerOpts = {
|
const dockerOpts =
|
||||||
authconfig: {
|
// If no registry is specified, we assume the image is a public
|
||||||
username: `d_${uuid}`,
|
// image on the default engine registry, and we don't need to pass any auth
|
||||||
password: currentApiKey,
|
registry != null
|
||||||
serverAddress: registry,
|
? {
|
||||||
},
|
authconfig: {
|
||||||
};
|
username: `d_${uuid}`,
|
||||||
|
password: currentApiKey,
|
||||||
|
serverAddress: registry,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {};
|
||||||
|
|
||||||
await dockerProgress.pull(image, onProgress, dockerOpts);
|
await dockerProgress.pull(image, onProgress, dockerOpts);
|
||||||
return (await docker.getImage(image).inspect()).Id;
|
return (await docker.getImage(image).inspect()).Id;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user