Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Offer slimmed down version of universal template that can be extended #1539

Open
kingces95 opened this issue Jul 18, 2022 · 3 comments
Open

Comments

@kingces95
Copy link

kingces95 commented Jul 18, 2022

Please offer a stripped-down version of the universal default image found at https://github.com/microsoft/vscode-dev-containers/tree/main/containers/codespaces-linux and stripped-down version of its devcontainer.json.

As a developer trying to entice my team to develop in codespace, I start by creating a demo. I start constructing my demo on top of the default universal image. I create a little script that modifies that universal image which adds tooling and makes it easy to switch between various contexts our team uses [e.g. az accounts]). Next, I'd like to cache those changes using the prebuilt feature so during the demo I don't have to run the script when the codespace starts to configure it.

To quickly create prebuilt images containing only the tools I need, I'd like to strip out all the tools I don't need from the universal image then run my script on top of that. To do that, I attempted to use the stripped down ubuntu image found at https://github.com/microsoft/vscode-dev-containers/tree/main/containers/ubuntu thinking that would be "just like the universal image" less the tooling. That turned out to be problematic because there are differences between those images beyond just the tooling. For example:

  • The user name (vscode/codespace)
  • The runArgs arguments

While the first is easy to work around, the second resulted in differences that took a few days to track down (I opened and closed this bug). In my case, I'm trying to use chroot in the codespace which requires the ability to use mount which works in the universal image but not the ubuntu image. After some debugging, I discovered copying the runargs from the universal image to the ubuntu image fixed the problem.

Stripping seems to be the approach recommended by the documentation. First, the documentation notes that extension is discouraged:

Given its size, we do not recommend extending this image.

Next, it suggests cloning the repro, copying the devcontainer source, and then stripping it down by hand. This feels backwards. It's going to be a little bit of challenge to figure out what script I need to run to configure Linux to run as is done in the universal container while stripping out the tools we don't use. For example, I guessing I'll need to be running with the --privileged flag but I'll have to test those other flags. After that, I'll need to strip down the base.Dockerfile https://github.com/microsoft/vscode-dev-containers/blob/main/containers/codespaces-linux/.devcontainer/base.Dockerfile. I need to keep things like setup-user.sh but what about the other stuff? And what about bug fixes as that stuff changes? I'll have to keep porting those changes over to my image.

Instead, I'd prefer the codespace team maintained a stripped down the universal image less all its tooling. Of course, then the question becomes where to draw the line. The goal would be to strip the image of the language specific tooling while keeping the bits that configure Linux itself. For example, keep all the tidbits that affect permissions, users, groups, UIDs, the stuff in runArgs, and lose the go, c#, rust, etc. After that's done, then the universal image would be built on top of that and contain only the kitchen sink tooling. That slim base image would also make a great reference for people who want to build on top of a different distribution.

Anyway, that's the idea! The product is amazing!!

@Chuxel
Copy link
Member

Chuxel commented Jul 18, 2022

//cc @joshspicer @edgonmsft @jkeech

@Chuxel
Copy link
Member

Chuxel commented Jul 18, 2022

@kingces95 The way this is coming together at the moment is you''d be able to use a base image like mcr.microsoft.com/vscode/devcontainers/base:ubntu and then take advantage of "Dev Container Features" to layer in additional tools. If you run "Add Development Container Configuration Files" and select a base definition, you'll see checkboxes to pick what you want to install. This is the start of that experience. See devcontainers/spec#61 and https://github.com/devcontainers/spec/blob/main/proposals/devcontainer-features.mdhttps://github.com/devcontainers/spec/blob/main/proposals/devcontainer-features.md

@jkeech
Copy link
Member

jkeech commented Jul 18, 2022

Yes! One of our goals is to refactor the universal image such that you can pick and choose subsets of functionality as devcontainer "features" to drop into your own custom image. We aim to have the large universal image just be the base ubuntu devcontainer image + a set of features.

Instead of providing a large matrix of official images with varying levels of slimmed-down granularity, you'll be able to choose the right combination of config for your needs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants