Programming inside Docker Container with VSCode

Programming inside Docker Container with VSCode

💡
This tutorial assumes that you already have Docker running on your machine and Dev Container extension instaled in your VSCode

Why

  • Consistent: Development environments across team members – everyone uses the exact same setup and you develeop your application in the same environment it will run in production.

  • Isolation: Dependencies and configurations don’t conflitc with other projects

  • Portability: Containers run reliable accross different machines and platforms

How

  1. Consider that you have the following Dockerfile in project root directory:
FROM ubuntu:24.04
WORKDIR /app
COPY . .
  1. Open the project directory in VSCode

  2. Press Ctrl+Shift+P and search for: Dev Container: Reopen in Container

  3. In the next prompt, select From Dockerfile

  4. In Optional Files/Directories, select .GitHub/debendabot.yml

VSCode will start the Docker Container and when finished, will open the IDE inside the container.

A directory called .devcontainer has been created. This directory has the configurations of Dev Container Extension for your project. See how customize your environment.