microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.62k stars 279 forks source link

Container features: Non-Debian distros #6884

Open dliberatore-th opened 2 years ago

dliberatore-th commented 2 years ago

My company's base container is based off Amazon Linux 2. The Dockerfile starts with FROM amazonlinux:2. This is roughly CentOS 7, so it's Red Hat based and uses yum instead of apt. Dnf is not available. To reduce friction, I want our devs to be able to use .devcontainer so they can test and debug their code in an environment similar to the runtime environment.

Currently, when I set up .devcontainer/Dockerfile to use this, it fails as follows. I've extracted the most relevant looking section. Apologies for the horizontal wrap/cutoff, that's what the file really contains.

 => CACHED [stage-1 1/2] COPY --from=dev_containers_feature_content_sourc  0.0s
 => [stage-1 2/2] RUN cd /tmp/build-features/local-cache && chmod +x ./in  0.4s
[2022-07-01T16:17:17.263Z] 
 => ERROR [stage-1 2/2] RUN cd /tmp/build-features/local-cache && chmod +  0.4s
------
 > [stage-1 2/2] RUN cd /tmp/build-features/local-cache && chmod +x ./install.sh
 && ./install.sh:
#0 0.390
#0 0.390 *********** Unsupported operating system "amzn" detected ***********
#0 0.390
#0 0.390 Features support currently requires a Debian/Ubuntu-based image. Update
 your
#0 0.390 image or Dockerfile FROM statement to start with a supported OS. For ex
ample:
#0 0.390 mcr.microsoft.com/vscode/devcontainers/base:ubuntu
#0 0.390
#0 0.390 Aborting build...
#0 0.390

The most relevant looking portion is:

Features support currently requires a Debian/Ubuntu-based image.

I don't mind rigging up the pieces here, I just want my team to have the ability to debug inside a standard container so we can get out of "works on my machine/doesn't work in CI" territory.

One solution would be to have an official way to use this distro. Another solution would be to provide an override for install.sh so I can rewrite it as it may pertain to my specific container. It's fine if that's unsupported with a big scary warning.

In short, my feature request is the option to use amazonlinux:2 for a base image even if I have to do extra work.

chrmarti commented 2 years ago

Your devcontainer.json appears to list "features", try removing that and check if it works.

"features" currently only support Debian-based distros. You can still install additional tools using your own Dockerfile and you can add VS Code extensions and settings under "customizations"."vscode".

dliberatore-th commented 2 years ago

Thanks. Removing the "features" section does get the container up and running without that error message. Reconstructing some of what that does was a little bit of an exercise but I think I managed ok.

I'm using script-library/common-redhat.sh from the repo vscode-dev-containers instead of the usual.

Additional tools are being installed the traditional way rather, via RUN statements at the end of .devcontainer/Dockerfile.

dss010101 commented 1 year ago

yeah..this is a problem. features does not support yum or dnf, the latter is which i use for amazon images