willis7 thinkyhead

Installing Marlin (VSCode devcontainer)

Introduction

A dev container is a pre-built Docker environment that is preinstalled with all the dependencies needed to build Marlin with VSCode. The devcontainer not only creates the code compilation environment but it also configures your VSCode with all the extensions needed. The end result is a completely configured VSCode ready to compile and upload Marlin.

The dev container official documentation can be found here.

System requirements

Local:

Getting started…

This quick-start covers how to set up a dev container for an existing project to use as your full-time development environment using existing source code on your filesystem. Follow these steps:

  1. Start VSCode, run the Remote-Containers: Open Folder in Container… command from the Command Palette (F1) or quick actions Status bar item, and select the Marlin project folder.

    Quick actions Status bar item

  2. The VSCode window will reload and start building the dev container. A progress notification provides status updates. You only have to build a dev container the first time you open it; opening the folder after the first successful build will be much quicker.

    Dev Container Progress Notification

  3. After the build completes, VSCode will automatically connect to the container.

You can now interact with your project in VSCode just as you could when opening the project locally. From now on, when you open the project folder, VSCode will automatically pick up and reuse your dev container configuration.

While using this approach to bind mount the local filesystem into a container is convenient, it does have some performance overhead on Windows and macOS. There are some techniques that you can apply to improve disk performance, or you can open a repository in a container using a isolated container volume instead.