Skip to content

georglauterbach/dev-container-base

Repository files navigation

Custom Development Container Base Image

About

A custom Development Container base image packed with as many as necessary and as few as possible configurations and applications to make development a breeze. This image is built for amd64 and arm64. Consult Dockerfile for the complete set of installation steps.

This container image partially builds on Hermes to install sensible defaults for the console and useful additional programs. Consult the documentation of Hermes if you’d like to further customize the experience.

Additonally, we configure common directories (like ${HOME}/.cache) with the correct permissions. We also set up doas so that you can simply run sudo inside the container without the need to enter a password.

You can use the environment variable DEV_CONTAINER_BASE to check whether you are using this image as a base (and hence, whether you are inside a container). This variable, if set, contains the version of the base image and the version control system revision, separated by a #.

We do not set a custom ENTRYPOINT with this image because the entrypoint is overwritten by Development Containers anyway, and we want to make the additional setup optional.

Optional Additional Setup

Proper Caching

To properly persist data that should be cached, you need to provide volumes in devcontainer.json for the following directories:

{
  // Persist the VS Code extension cache
  "source": "<PROJECT>-cache-vscode_extensions",
  "target": "/home/ubuntu/.vscode-server/extensions",
  "type": "volume"
},
{
  // Persist the `${HOME}/.cache` directory
  "source": "<PROJECT>-cache-home_cache",
  "target": "/home/ubuntu/.cache",
  "type": "volume"
}
Important

While this image performs permission adjustments for /home/ubuntu/.vscode-server, you should mount the volume for caching extensions to /home/ubuntu/.vscode-server/extensions. Otherwise, the Development Container settings are cached as well, which may leed to your settings not being updated.

Locale Setup

When building on top of this image, you can call sudo update_locales.sh <LOCALE> to set a new locale. The default is en_US.UTF-8.