Getting Started with Development Containers in VS Code
Module Source
Use a Docker container as a development environment with Visual Studio Code
Goals
In this workshop, you will learn how to access, customize, and add software to development containers in Visual Studio Code so that you can collaborate with ease across machines and development environments.
Goal | Description |
---|---|
What will you learn | How to load and connect to a remote project, customize settings when working with a development container, and add software to the container environment. |
What you’ll need | Visual Studio Code, Docker Desktop, and Git |
Duration | 1 hour |
Slides | Powerpoint |
Video
🎥 Click this image to watch Ornella walk you through the workshop
Pre-Learning
- Overview of Containers and Docker
- Introduction to Git
- Use a Docker container as a development environment with Visual Studio Code
Prerequisites
What students will learn
Say you’re working on a hackathon project with your classmates using Python, and you want to make sure that your project is compatible across multiple machines. In this workshop, you will learn how you can use development containers to work on any project without having to set up or configure your machine first.
Prepare the project
In this section, you’ll do some setup to open a sample project written in Python, and install the Remote Containers extension for Visual Studio Code.
Use the Remote - Containers extension
Next, you’ll learn how to use the Remote - Containers extension in Visual Studio Code. You’ll be able to understand how Docker and Visual Studio Code make it possible to have projects contained in their own preconfigured, containerized environments using the extension.
Add a dev container to an existing project
Now that you have the extension ready to go, you’ll add a dev container and open the sample project in the container.
Customize project and editor settings
After setting up the dev container for the project, you’ll learn how to customize and automate all the project setup using the devcontainer.json file.
Add software to an existing container
So far, you’ve learned how to add a preconfigured dev container and customize it using the devcontainer.json file. Next, you’ll learn how to add software beyond what’s available in those preconfigured dev containers to further customize your experience. Apply what you learned by using a Dockerfile to add Node.js to your container.
Quiz
Next steps
- Remote - Containers tutorial
- Learn to create a development container
- Main Remote - Containers documentation
- How students can use dev containers
Practice
To test your knowledge, try creating your own development container filled with your favorite coding tools. Share it with a friend!
Feedback
Be sure to give feedback about this workshop!