Skip to content

Using Dockerfile to build devcontainer with Podman causes VSCode to hang #9748

@awesomekyle

Description

@awesomekyle

When creating a devcontainer from a Dockerfile using Podman, VSCode hangs because Podman doesn't pull from localhost/ when using the --platform build arg. Because the terminal Dev Container terminal window can't be interacted with at all, this means VSCode hangs forever and the only way to stop it is to kill VSCode.

The Dockerfile builds correctly ("Successfully tagged localhost/vsc-podman....") and then VSCode does some additional setup using the /tmp/devcontainercli-kyle/updateUID.Dockerfile-0.58.0 file, which has the following first two lines:

ARG BASE_IMAGE
FROM $BASE_IMAGE
...

BASE_IMAGE=vsc-podman-devcontainer-41....53dbb is being set in the podman build command. The issue is that podman build prompts for the registry as shown in the image below:

Screenshot from 2024-04-04 19-26-22

.devcontainer/devcontainer.json

If I use the image option, the container is created correctly. It only fails when BASE_IMAGE is a local image.

{
  "name": "Alpine",

  // "image": "mcr.microsoft.com/devcontainers/base:alpine-3.19",
  "build": { "dockerfile": "Dockerfile" },

  "workspaceMount": "",
  "runArgs": [
    "--userns=keep-id",
    "--volume=${localWorkspaceFolder}:/workspaces/${localWorkspaceFolderBasename}:z"
  ],
  "containerUser": "vscode"
}

.devcontainer/Dockerfile

FROM mcr.microsoft.com/devcontainers/base:alpine-3.19

Workaround:

  • If /etc/containers/registries.conf only has one unqualified-search-registries, podman won't prompt for a selection so the container creation will work correctly.
  • After it fails, manually run the command that hung, choosing any prompted registry (it doesn't matter, Podman pulls locally regardless). Edit: After further testing this isn't true. VSCode tries to rebuild it regardless.
  • Push the base container to a registry instead of using the build option. Edit: Using features also causes new containers to be built, so this workaround only works if you don't use devcontainer features.

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugcontainersIssue in vscode-remote containerspodmanDev Container using PodmanupstreamIssue identified as 'upstream' component related (exists outside of VS Code Remote)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions