-
Notifications
You must be signed in to change notification settings - Fork 362
Description
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:
.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 oneunqualified-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: Usingfeatures
also causes new containers to be built, so this workaround only works if you don't use devcontainer features.