Layered-vscode error with new DevContainers - [Solved]

I am running a layered installed vscode.
When I try to create a DevContainer I am getting an error related to this file devContainersSpecCLI.js. I have looked in the internet but I haven’t found a solution.

I have tried in different ways possible: providing docker to DevContainers Docker Path, podman, a script with docker, etc.

This is a screenshot of the error:

The full path to which the error refers is
/root/.vscode-remote-containers/dist/dev-containers-cli-0.362.0/dist/spec-node/devContainersSpecCLI.js

I have tried with several of the DevContainer examples that pop up when you choose “New DevContainer”, and all of them throw error.

Has anyone had a problem like this?

My OS is a fresh Fedora Silverblue 40 installation.

1 Like

You really should not be running such apps when logged in as root.

Many problems can occur since the privileges of root allow changes in the system that even the ‘atomic’ desktop may not prevent.

I suggest that you use only your regular user and only use root privileges when absolutely necessary. This is the standard paradigm used for all linux systems and how they are administered.

No, I am not running it as root, just like a regular user.
The root label comes from inside the debugging console in vscode.
From what I am learning from the GitHub issues posts is that vscode DevContainers use internally that convention. That root label could be created under a /tmp folder, for instance. root just means it is the top of the tree. It doesn’t mean at all the Linux root user.

Strange, this could be an issue, as Podman may see it as if you would like to create a rootful container.

Is there any way for you to paste the error here in </> preformatted text ?

Does attaching to exiting containers in the sidebar work? Or is it only dev containers that are broken?

1 Like

I haven’t tested with existing Devcontainers. I thought it was going to be easier and faster just creating a typical DevContainer from the selection MS offers. As a matter of fact, I was testing after I figured it out how to integrate layered-vscode with Distrobox containers. But the issues are totally unrelated.

What is surprising though is that most of the examples fail - the one I am focusing is the one that says “Data Science with Python and R” - but couple of them, that are simple, like the one at the top, based on Alpine, build fine sometimes.

I’d like to have a look at the error message, it just a little hard to follow, and would be better than me spinning up a VM, and recreating this myself. If you can.

I am not at my desk now. I only have screenshots available in my iPad.

1 Like

No problem. Will still have a look at it. Might update this response with a couple questions later.

Sure. My pleasure. Thanks.
Just give me some time.

This error is a recurring issues in VS Code with DevContainer as far as 2022.

Related Issues

1 Like

@hamrheadcorvette
as requested

[25 ms] Dev Containers 0.362.0 in VS Code 1.89.1 (dc96b837cf6bb4af9cd736aa3af08cf8279f7685).
[24 ms] Start: Resolving Remote
[31 ms] Start: Check Docker is running
[31 ms] Start: Run: docker version
[53 ms] Client: Docker Engine - Community
 Version:           26.1.3
 API version:       1.45
 Go version:        go1.21.10
 Git commit:        b72abbb
 Built:             Thu May 16 08:35:25 2024
 OS/Arch:           linux/amd64
 Context:           rootless

Server: Docker Engine - Community
 Engine:
  Version:          26.1.3
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.10
  Git commit:       8e96db1
  Built:            Thu May 16 08:33:42 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.31
  GitCommit:        e377cd56a71523140ca6ae87e30244719194a521
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
 rootlesskit:
  Version:          2.0.2
  ApiVersion:       1.1.1
  NetworkDriver:    slirp4netns
  PortDriver:       builtin
  StateDir:         /run/user/1001/dockerd-rootless
 slirp4netns:
  Version:          1.2.2
  GitCommit:        0ee2d87523e906518d34a6b423271e4826f71faf
[58 ms] Start: Run: docker build -f /tmp/vsch-msfz751/bootstrap-image/0.362.0/bootstrap.Dockerfile -t vsc-volume-bootstrap /tmp/vsch-msfz751/bootstrap-image/0.362.0
[+] Building 193.7s (13/13) FINISHED                                                               docker:rootless
 => [internal] load build definition from bootstrap.Dockerfile                                                0.2s
 => => transferring dockerfile: 1.08kB                                                                        0.0s
 => [internal] load metadata for mcr.microsoft.com/devcontainers/base:0-alpine-3.16                           1.4s
 => [internal] load .dockerignore                                                                             0.1s
 => => transferring context: 2B                                                                               0.0s
 => [1/8] FROM mcr.microsoft.com/devcontainers/base:0-alpine-3.16@sha256:2b525b9d4a00ecf0a6f1725e57aa01b192  77.4s
 => => resolve mcr.microsoft.com/devcontainers/base:0-alpine-3.16@sha256:2b525b9d4a00ecf0a6f1725e57aa01b192f  0.2s
 => => sha256:2b525b9d4a00ecf0a6f1725e57aa01b192f0f79bc57780f62e892ebe955a343c 1.61kB / 1.61kB                0.0s
 => => sha256:c3313985418bab47c31830cbb8da6b74c254d3c8f3173672bdc71099f2556237 1.81kB / 1.81kB                0.0s
 => => sha256:fba726ae349c2fb0fc7a6f4a07821bb16d763c87c3f2fb3f48ec81ec47dc42da 9.51kB / 9.51kB                0.0s
 => => sha256:a88dc8b54e91eb6b19695ef7e04865926d4df23004f414a3ee86978617492d4d 2.81MB / 2.81MB                1.2s
 => => sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 32B / 32B                      0.7s
 => => sha256:28aa05b47ac536e5e91328637823419cc076cac5e2722696c8365ce88521f66c 411B / 411B                    1.0s
 => => sha256:483586495ec58a41f4fc191ab70e4906eb810a959c72d5cfe05908be9c38d82f 135B / 135B                    1.3s
 => => sha256:85d9b35043c721197d28fdc8311e3a1c36327e1f523d72c54a25d49bca9d46c5 224B / 224B                    1.2s
 => => extracting sha256:a88dc8b54e91eb6b19695ef7e04865926d4df23004f414a3ee86978617492d4d                     0.0s
 => => sha256:cd3ef81b7e54f32b9d2f7dc493ad7aa68e3626fc1d5b8ef899bb921c41d67d99 234B / 234B                    1.7s
 => => sha256:9c8715c3b1fec25f06b3321d5bea6d168c428a0f079bcfc4302adf057c71221e 189.62MB / 189.62MB           73.1s
 => => extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1                     0.0s
 => => extracting sha256:28aa05b47ac536e5e91328637823419cc076cac5e2722696c8365ce88521f66c                     0.0s
 => => sha256:aa480694647bfde504fdd99be1d3a9d59ab82eec685ec904deded407bbd4da84 43.80MB / 43.80MB             41.5s
 => => extracting sha256:483586495ec58a41f4fc191ab70e4906eb810a959c72d5cfe05908be9c38d82f                     0.0s
 => => extracting sha256:85d9b35043c721197d28fdc8311e3a1c36327e1f523d72c54a25d49bca9d46c5                     0.0s
 => => extracting sha256:cd3ef81b7e54f32b9d2f7dc493ad7aa68e3626fc1d5b8ef899bb921c41d67d99                     0.0s
 => => extracting sha256:9c8715c3b1fec25f06b3321d5bea6d168c428a0f079bcfc4302adf057c71221e                     2.1s
 => => extracting sha256:aa480694647bfde504fdd99be1d3a9d59ab82eec685ec904deded407bbd4da84                     1.0s
 => [internal] load build context                                                                             0.2s
 => => transferring context: 2.04MB                                                                           0.0s
 => [2/8] COPY host-ca-certificates.crt /tmp/host-ca-certificates.crt                                         0.1s
 => [3/8] RUN cat /tmp/host-ca-certificates.crt >> /etc/ssl/certs/ca-certificates.crt                         0.4s
 => [4/8] RUN csplit -f /usr/local/share/ca-certificates/host-ca-certificate- -b '%02d.pem' -z -s /tmp/host-  0.4s
 => [5/8] RUN echo "@old https://dl-cdn.alpinelinux.org/alpine/v3.15/main" >> /etc/apk/repositories           0.4s
 => [6/8] RUN apk add --no-cache  git-lfs  nodejs  python3  npm  make  g++  docker-cli  docker-cli-buildx    99.8s
 => [7/8] RUN npm config set cafile /etc/ssl/certs/ca-certificates.crt && cd && npm i node-pty || echo "Cont  9.8s
 => [8/8] COPY .vscode-remote-containers /root/.vscode-remote-containers                                      0.2s
 => exporting to image                                                                                        2.8s
 => => exporting layers                                                                                       2.7s
 => => writing image sha256:5de1b03b651d9a8ee10c6e65f5ee9e3e07c80743b6e286a6bd51ef72d87aab5b                  0.0s
 => => naming to docker.io/library/vsc-volume-bootstrap                                                       0.0s
[193935 ms] Start: Run: docker run -d --mount type=volume,src=alpine,dst=/workspaces -v /var/run/docker.sock:/var/run/docker.sock vsc-volume-bootstrap sleep infinity
[194466 ms] Start: Run in container: /bin/sh
[194472 ms] Running Dev Containers CLI:   read-configuration --workspace-folder /workspaces/alpine --id-label vsc.devcontainer.volume.name=alpine --id-label vsc.devcontainer.volume.folder=alpine --log-level debug --log-format json --mount-workspace-git-root --terminal-columns 115 --terminal-rows 25
[194613 ms] Start: Run in container: node /root/.vscode-remote-containers/dist/dev-containers-cli-0.362.0/dist/spec-node/devContainersSpecCLI.js read-configuration --workspace-folder /workspaces/alpine --id-label vsc.devcontainer.volume.name=alpine --id-label vsc.devcontainer.volume.folder=alpine --log-level debug --log-format json --mount-workspace-git-root --terminal-columns 115 --terminal-rows 25
[194879 ms] @devcontainers/cli 0.59.1. Node.js v16.20.2. linux 6.8.9-200.fc39.x86_64 x64.
[194879 ms] Start: Run: git rev-parse --show-cdup
[194888 ms] Start: Run: docker ps -q -a --filter label=vsc.devcontainer.volume.name=alpine --filter label=vsc.devcontainer.volume.folder=alpine
[194916 ms] Command failed: docker ps -q -a --filter label=vsc.devcontainer.volume.name=alpine --filter label=vsc.devcontainer.volume.folder=alpine
[194922 ms] Exit code 1
[194924 ms] Command failed: node /root/.vscode-remote-containers/dist/dev-containers-cli-0.362.0/dist/spec-node/devContainersSpecCLI.js read-configuration --workspace-folder /workspaces/alpine --id-label vsc.devcontainer.volume.name=alpine --id-label vsc.devcontainer.volume.folder=alpine --log-level debug --log-format json --mount-workspace-git-root --terminal-columns 115 --terminal-rows 25
[194924 ms] Exit code 1
1 Like

Try this command :
docker ps -q -a --filter label=vsc.devcontainer.volume.name=alpine --filter label=vsc.devcontainer.volume.folder=alpine

:thinking:

Returns nothing!

1 Like

I’ll be back in a little while, I’m going to create this myself too. Thanks for the reply. I will try to reconfigure with Podman as well to see if it does help. . .

1 other thing, Do you have Podman running? if so disable it then try what you normally do. Maybe there’s conflict.

sudo systemctl stop podman.service

1 Like

This is the command that fails:

node /root/.vscode-remote-containers/dist/dev-containers-cli-0.362.0/dist/spec-node/devContainersSpecCLI.js read-configuration --workspace-folder /workspaces/alpine-3 --id-label vsc.devcontainer.volume.name=alpine-3 --id-label vsc.devcontainer.volume.folder=alpine-3 --log-level debug --log-format json --mount-workspace-git-root

But I can see the files created under /tmp/vsch-user, which is root for vscode.
image

devContainersSpecCLI.js is a 1.8 MB file.

1 Like

Maybe we get somewhere here?

Check the Permissions :

ls -lZ /workspaces/alpine-3/.devcontainer.json

Let’s see if your user has the right permissions to read it.

image

image

No files in there!

Although, I found alpine-3 here:

devcontainer.json content:

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/alpine
{
	"name": "Alpine",
	// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
	"image": "mcr.microsoft.com/devcontainers/base:alpine-3.19"

	// Features to add to the dev container. More info: https://containers.dev/features.
	// "features": {},

	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	// "forwardPorts": [],

	// Use 'postCreateCommand' to run commands after the container is created.
	// "postCreateCommand": "uname -a",

	// Configure tool-specific properties.
	// "customizations": {},

	// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
	// "remoteUser": "root"
}

1 Like

IDK if this is being surprised or emphatic :thinking: :laughing:

When it should be in /workspaces/alpine-3/.devcontainer.json copy it and place it here. . .