Skip to content

updateRemoteUserUID fails on Podman + Docker Compose: localhost/ prefix applied to a docker.io/library/ image #1364

Todo

Description

Problem

With cliVariant === "podman", the CLI prefixes the base image with localhost/ when building the -uid image for updateRemoteUserUID. That is correct for the single-container path, where Podman tags locally built images under localhost/. It is wrong for the Compose path, where docker-compose commits the service image as docker.io/library/<project>-<service>. Podman then treats localhost as a registry hostname and tries to pull over HTTPS.

Same root cause family as #1300: the Compose path never received the Podman-specific handling.

Reproduction

Minimal repro, no features, non-root remoteUser, updateRemoteUserUID left at its default:

.devcontainer/Dockerfile

FROM docker.io/library/debian:trixie-slim
RUN useradd -m -u 1000 vscode

.devcontainer/compose.yaml

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    command: sleep infinity
    volumes:
      - ..:/workspace

.devcontainer/devcontainer.json

{
  "name": "ucidrepro",
  "dockerComposeFile": "compose.yaml",
  "service": "app",
  "workspaceFolder": "/workspace",
  "remoteUser": "vscode"
}

Then devcontainer up --workspace-folder .

Note: this host uses the podman-docker shim, so docker in the logs below is Podman 5.7.0.

Observed

Compose builds and tags the image:

[2/2] COMMIT docker.io/library/ucidrepro_devcontainer-app
Successfully tagged docker.io/library/ucidrepro_devcontainer-app:latest

podman images confirms the only tag is docker.io/library/ucidrepro_devcontainer-app:latest. The CLI then runs:

docker build -f /tmp/devcontainercli-negro/updateUID.Dockerfile-0.91.0 \
  -t vsc-ucidrepro-...-uid --platform linux/amd64 \
  --build-arg BASE_IMAGE=localhost/ucidrepro_devcontainer-app \
  --build-arg REMOTE_USER=vscode --build-arg NEW_UID=1000 ...

which fails:

STEP 1/9: FROM localhost/ucidrepro_devcontainer-app
Trying to pull localhost/ucidrepro_devcontainer-app:latest...
Error: creating build container: unable to copy from source
docker://localhost/ucidrepro_devcontainer-app:latest: initializing source
docker://localhost/ucidrepro_devcontainer-app:latest: pinging container registry
localhost: Get "https://localhost/v2/": dial tcp 127.0.0.1:443: connect: connection refused

Cause

In the 0.91.0 bundle:

"--build-arg", `BASE_IMAGE=${e.cliVariant==="podman" && !LW(t) ? "localhost/" : ""}${t}`
function LW(e){
  if (e.startsWith("localhost/")) return true;
  let A = e.indexOf("."), t = e.indexOf("/");
  return A !== -1 && t !== -1 && A < t;
}

The guard skips the prefix only when the name already starts with localhost/, or when a dot precedes the first slash. Compose passes the short name ucidrepro_devcontainer-app — no dot, no slash — so the prefix is added even though the image is tagged docker.io/library/....

Suggested fix

Resolve the image locally before prefixing — e.g. podman image exists <name>, or inspect and use the returned repo tag — rather than inferring the registry from the string shape. The single-container path is unaffected because those images genuinely are tagged localhost/....

Workaround

"updateRemoteUserUID": false, with the Dockerfile creating the user at the host UID directly.

Environment

  • devcontainer CLI 0.91.0
  • podman 5.7.0, rootless, crun 1.21, netavark, overlay
  • docker-compose-v2 2.40.3, podman-docker shim
  • Ubuntu 26.04, x86_64

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions