Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.
This repository was 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

@kingces95

Description

@kingces95

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!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions