-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error installing feature node #440
Comments
Hi 👋 I tried to reproduce with this dev container 👇 {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {},
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
},
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
"version": "latest",
"moby": false,
"dockerDashComposeVersion": "v2"
}
},
} The node Feature installed without any errors for me. @samstride Can you paste your entire dev config? That might help investigate. |
Image looks like this: ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
FROM golang:1.20.0-bullseye
ARG USERNAME
ARG USER_UID
ARG USER_GID
# Create the user
RUN groupadd --gid ${USER_GID} ${USERNAME} \
&& useradd --uid ${USER_UID} --gid ${USER_GID} -m ${USERNAME}
# Install some common packages
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install \
git-all \
vim \
clang-format \
ca-certificates \
curl \
gnupg \
pass \
lsb-release \
--no-install-recommends Config looks like this: // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/go
{
"name": "dev",
"build": {
"dockerfile": "Dockerfile"
},
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
],
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"golang.Go",
"ms-azuretools.vscode-docker",
"zxh404.vscode-proto3",
"xaver.clang-format",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"yzhang.markdown-all-in-one",
"bradymholt.pgformatter",
"emeraldwalk.runonsave",
"redhat.vscode-xml",
"redhat.vscode-yaml",
"dbaeumer.vscode-eslint"
]
}
},
// 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": "devcontainer/init.sh", //Custom install script.
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {},
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
},
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
"version": "latest",
"moby": false,
"dockerDashComposeVersion": "v2"
}
},
"containerEnv": {
"TZ": "Pacific/Auckland"
}
} Extension version = Thanks. |
The issue is with your @samstride Can you update your devcontainer.json as follows? This solved the issue for me // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/go
{
"name": "dev",
"image": "golang:1.20.0-bullseye",
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
],
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"golang.Go",
"ms-azuretools.vscode-docker",
"zxh404.vscode-proto3",
"xaver.clang-format",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"yzhang.markdown-all-in-one",
"bradymholt.pgformatter",
"emeraldwalk.runonsave",
"redhat.vscode-xml",
"redhat.vscode-yaml",
"dbaeumer.vscode-eslint"
]
}
},
// 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": "devcontainer/init.sh", //Custom install script.
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"username": "vscode"
},
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
},
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
"version": "latest",
"moby": false,
"dockerDashComposeVersion": "v2"
}
},
"containerEnv": {
"TZ": "Pacific/Auckland"
}
} ℹ️ Also, opened devcontainers/images#412, we would release tip: The docker-outside-of-docker, adds the run-args, feel free to skip them! |
@samruddhikhandale , thanks.
Can you elaborate on that. I was using this guide here: https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user#_creating-a-nonroot-user My bad, I forgot to paste the end of my Dockerfile, which is: USER ${USERNAME}
# Install few other packages
.
.
> I used the setting : "ghcr.io/devcontainers/features/common-utils:2": {
"username": "vscode"
} and I still get the same error. Btw, thanks for the tip 👍
Hmmm, this one is a tricky one. Historically, the go feature can be 1+ weeks late. Hence, we decided to use the official image which is usually out within a few hours of the go release. |
Feel free to reopen if the issue resurfaces! |
@samruddhikhandale , Thanks. Still curious to know what is the correct way to set the user:
I was using this guide here: https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user#_creating-a-nonroot-user |
I am not sure what's the exact issue was in there (I'll take a peek), but it's nice to use the |
If we remove Also, the issue seems to pop up only if |
@samruddhikhandale @samstride have you found a fix for this issue? I am getting the same error after migrating from @microsoft/vscode-dev-containers. I use VS Code v1.75.1 with Docker Desktop v4.16.2 (95914) on Apple M1 Ventura v13.2, if that helps. |
@kosalanuwan , I never got it to work. Are you getting the exact same error? Does your devcontainer work if you remove node? Since I use my own images (mostly because I want to maintain my own velocity), I installed node in the base image. You could do something like this in your json to see if it will work: // "image": "mcr.microsoft.com/devcontainers/base:dev-bullseye",
"build": {
"dockerfile": "Dockerfile"
}, Then create a Dockerfile in FROM mcr.microsoft.com/devcontainers/base:dev-bullseye
# Install NodeJS LTS
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - &&\
apt-get install -y nodejs ... and don't forget to remove the feature node in your json if you build your own Dockerfile like above. |
@kosalanuwan Can you remove the common-utils Feature and retry? The |
@samruddhikhandale this worked for me! Appreciate the support 🥳 |
I ran into this same issue and finally figured out what was happening. The guide for creating a nonroot user (linked to above) calls The simplest resolution is to add |
@samstride I'd avoid managing Dockerfiles, so I use the @samruddhikhandale It works fine with the |
Hi,
With a json file like this:
I get the following error during start up:
Thanks.
The text was updated successfully, but these errors were encountered: