Skip to content

Development Container Base Image for Common Tasks

License

Notifications You must be signed in to change notification settings

georglauterbach/dev-container-base

Repository files navigation

Custom Development Container Base Image

About

When working with Development Containers, you most likely build on top of existing images to utilize their existing tools and configuration. This project provides an image packed with as many as necessary and as few as possible configurations and applications to make development a breeze. You can use this image directly, or build on top of it, when configuring your Development Container.

Technical Information

This image

  1. is based on docker.io/ubuntu and built for amd64 and arm64. Consult Dockerfile for the complete set of installation steps.

  2. heavily 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. The process is described here.

  3. configures common directories (like ${HOME}/.cache) with the correct permissions.

  4. sets environment variables such as

    1. DEV_CONTAINER_BASE_VERSION=<RELEASE VERSION>#<VERSION CONTROL SYSTEM REVISION> to check that you are inside a container, to check that you are using this image as a base, and to acquire information about the actual version.

    2. DEV_CONTAINER_BASE_HERMES_VERSION=<VERSION OF HERMES USED FOR BUILDING> to qcquire information about the version of hermes that is used.

  5. sets up doas so that you can simply run sudo inside the container without the need to enter a password.

  6. sets up a system locale, defaulting to en_US.UTF-8.

  7. does not set nor require a custom ENTRYPOINT.

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; do not mount to `/home/ubuntu/.vscode-server`,
  // otherwise, all settings are cached and hence, not be updated anymore.
  "source": "<PROJECT>-cache-vscode_extensions",
  "target": "/home/ubuntu/.vscode-server/extensions",
  "type": "volume"
},
{
  // Persist the `${HOME}/.cache` directory so that common
  // caches are not lost on container restart.
  "source": "<PROJECT>-cache-home_cache",
  "target": "/home/ubuntu/.cache",
  "type": "volume"
}

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.