Skip to content

Commit c1c8b08

Browse files
committed
Check if image name has registry host (microsoft/vscode-remote-release#9748)
1 parent d00db63 commit c1c8b08

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Notable changes.
44

55
## April 2024
66

7+
### [0.59.1]
8+
- Check if image name has registry host. (https://github.com/microsoft/vscode-remote-release/issues/9748)
9+
710
### [0.59.0]
811
- Propagate --cache-from to buildx build. (https://github.com/devcontainers/cli/pull/638)
912
- Disable cache on feature build when `--build-no-cache` is passed. (https://github.com/devcontainers/cli/pull/790)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@devcontainers/cli",
33
"description": "Dev Containers CLI",
4-
"version": "0.59.0",
4+
"version": "0.59.1",
55
"bin": {
66
"devcontainer": "devcontainer.js"
77
},

src/spec-node/containerFeatures.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ export async function updateRemoteUserUID(params: DockerResolverParameters, merg
431431
'-f', destDockerfile,
432432
'-t', fixedImageName,
433433
...(platform ? ['--platform', platform] : []),
434-
'--build-arg', `BASE_IMAGE=${params.isPodman ? 'localhost/' : ''}${imageName}`, // Podman: https://github.com/microsoft/vscode-remote-release/issues/9748
434+
'--build-arg', `BASE_IMAGE=${params.isPodman && !hasRegistryHostname(imageName) ? 'localhost/' : ''}${imageName}`, // Podman: https://github.com/microsoft/vscode-remote-release/issues/9748
435435
'--build-arg', `REMOTE_USER=${remoteUser}`,
436436
'--build-arg', `NEW_UID=${await cliHost.getuid!()}`,
437437
'--build-arg', `NEW_GID=${await cliHost.getgid!()}`,
@@ -445,3 +445,12 @@ export async function updateRemoteUserUID(params: DockerResolverParameters, merg
445445
}
446446
return fixedImageName;
447447
}
448+
449+
function hasRegistryHostname(imageName: string) {
450+
if (imageName.startsWith('localhost/')) {
451+
return true;
452+
}
453+
const dot = imageName.indexOf('.');
454+
const slash = imageName.indexOf('/');
455+
return dot !== -1 && slash !== -1 && dot < slash;
456+
}

0 commit comments

Comments
 (0)