Aller au contenu principal
Nicolas Cousin Tech SolutionsNicolas Cousin Tech Solutions
Intermediate2 h 30

Estimated — self-paced course, go at your own speed.

Dev Containers and pre-commit: writing your own configuration

This track assumes you can already open an existing Dev Container and read every field of its devcontainer.json, and that you know how to install pre-commit and tell a native hook apart from a pre-commit hook — the skills covered by modules 3, 4, 5 and 6 of the [Beginner](/en/academy/devcontainers-precommit-beginner) track. Here, you move to writing: two independent threads run in parallel — one where you build a devcontainer.json and add an official Feature to it, and one where you write a multi-hook .pre-commit-config.yaml and learn to diagnose a broken one. Both threads converge in the last module, where you wire pre-commit directly into the container's lifecycle.

Modules

  1. 1Writing a devcontainer.json from scratchChoose a base image, a postCreateCommand, a port, and an extension for a real small project, then prove the app actually runs inside the container.
  2. 2Adding a Dev Container FeatureAdd a Python runtime to your Node.js container using an official Feature, with the exact registry syntax — and proof the tool actually installed.
  3. 3Writing a multi-hook .pre-commit-config.yamlChain a formatter, a linter, and a generic check in a real pre-commit configuration, with the exact repos/rev/hooks schema.
  4. 4Diagnosing and fixing a broken pre-commit configurationA realistic hook-id typo, the exact CLI error it produces, and how to diagnose it without guessing.
  5. 5Wiring pre-commit into the devcontainer lifecyclePlug pre-commit install into postCreateCommand so every contributor gets active hooks with zero manual setup.