devcontainers / devcontainers/features

Consider splitting up the `common` feature

Open
#67 11 comments 7 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
1.5k
Forks
621
Avg merge
6d 53m
Merged PRs (30d)
9

Description

We could consider deprecating the common feature (similar to some of the ones mentioned in https://github.com/devcontainers/features/issues/64) and creating multiple features out of it.

The current `common` feature contains (text from @Chuxel):

---

### 1. [Common OS Utilities](https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/common-debian.sh#L74-L165), [set a locale if one not there](https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/common-debian.sh#L174-L180), [systemctl shim](https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/common-debian.sh#L285-L295)

- [ ] A “common utilities” feature w/o sudo. To recap, its goal is to install:

* Common command line utilities used in shell scripts (e.g., ps, lsof, wget, curl + ca-certificates zip, unzip, tar, net-tools)
* Utilities frequently referenced in Linux install instructions (apt-transport-https, lsb-release, jq, gnupg2 + dirmngr)
* Man pages (man-db, manpages, manpages-dev, manpages-posix manpages-posix-dev)
* Libraries frequently required by native code that is not statically compiled (libc6, libgcc1, libkrb5-3, libgssapi-krb5-2, libicu[0-9][0-9], liblttng-ust[0-9], libstdc++6, zlib1g)
* Give people a hint for what to do w/o systemctl since systemd is rarely in container images, but pass through if it’s there. Lots of Linux instructions reference it so it was added in time because of customer confusion.

> Many of these are already in images like “node”, but they’re checked for coverage since they can be missing from minimal images like “debian”. Adding a default locale is a good idea given the number of developer tools that can bomb without it, but we could give the option to pick a locale. Right now, it’s always en_US.UTF-8. In theory we could pull out git in favor of the git feature but given how central it is to developer images and it only installs if not present, it might be worth keeping.

---

### 2. [Default bash theme](https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/common-debian.sh#L301-L322)

- [ ] Include in “common utilities” but change the default so the source code portion of it is off by default since this can be slow in massive repos. Also disabling source control is mandatory if git is removed from common utilities. Rename it to “devcontainers-default” instead of “codespaces.”

---

### 3. [apt-get upgrade option](https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/common-debian.sh#L167-L172)

- [ ] New “apt” feature which includes upgrade and the option to install packages from a list.

---

### 4. [Non-root user and w/sudo setup](https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/common-debian.sh#L183-L213)

- [ ] Add into devcontainer.json as a core option including installing, configuring sudo @chrmarti (Proposal: https://github.com/devcontainers/spec/issues/75)

---

### 5. [Zsh + Oh My Zsh](https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/common-debian.sh#L365-L405) + [Default Theme](https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/common-debian.sh#L365-L405)

- [ ] New “ZSH” feature that includes default theme but makes it an option. Rename the theme “devcontainers-default.”

---

### 6. [Set git editor to “code” if in VS Code terminal window and editor not already set](https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/common-debian.sh#L250-L259)

- [ ] Built-in feature of Remote – Containers and Codespaces. Its presence here is a hack.

---

### 7. [“code” auto-maps to code-insiders if we’re in a container created by code-insiders](https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/common-debian.sh#L264-L283) (since “code” won’t ever work)

- [ ] Built-in feature of Remote – Containers and Codespaces. Its presence here is a hack.

---

### 8. [devcontainer-info command](https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/common-debian.sh#L407-L443)

- [ ] Separate Feature specifically used in images from https://github.com/devcontainers/images. Very useful command for debugging, but it uses a file output by the image build setup.

---

### 9. [First run message](https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/common-debian.sh#L238-L248)

- [ ] Built-in feature of Remote – Containers and Codespaces. Reuse same file location for back compat.

Its inclusion here was always a workaround. Tactically we could just make this a separate feature, but it’s always been a bit of an ugly hack.

---

### 10. [common-redhat.sh](https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/common-redhat.sh), [common-alpine.sh](https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/common-alpine.sh)

- [ ] Merge these two scripts into the “common utilities” and “zsh” features. We can detect whether apt, yum, or apk are there to figure out which scenario we are in. Most of the script is the same aside from how the packages are installed.

Contributor guide

Open the contributing guide

Research direction

Start by comparing script-library/common-debian.sh with common-redhat.sh and common-alpine.sh, using the numbered sections in the issue as the proposed boundaries. Review the related discussion in issue 64 before deciding whether the existing feature behavior can be separated cleanly. Done means the common responsibilities are assigned to maintainable features without losing the listed utilities, shell setup, or compatibility behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
devops, tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.