Docker in Visual Studio Code

The Docker extension makes it easy to build, manage, and deploy containerized applications in Visual Studio Code.

This page provides an overview of the Docker extension capabilities; use the side menu to learn more about topics of interest. If you are just getting started with Docker development, try the Docker tutorial first to understand key Docker concepts.

Installation

Install Docker on your machine and add it to the system path.

On Linux, you should also enable Docker CLI for the non-root user account that will be used to run VS Code.

To install the extension, open the Extensions view (⇧⌘X (Windows, Linux Ctrl+Shift+X)), search for docker to filter results and select Docker extension authored by Microsoft.

Select Docker extension

Editing Docker files

You can get IntelliSense by clicking ⌃Space (Windows, Linux Ctrl+Space) when editing your Dockerfile and docker-compose.yml files, with completions and syntax help for common commands.

IntelliSense for Dockerfiles

In addition, you can use the Problems panel (⇧⌘M (Windows, Linux Ctrl+Shift+M)) to view common errors for Dockerfile and docker-compose.yml files.

Generating Docker files

You can add Docker files to your workspace by opening the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P)) and using Docker: Add Docker Files to Workspace command. The command will generate Dockerfile and .dockerignore files and add them to your workspace. The command will also ask you if you want to add Docker Compose files as well, but this is optional.

The extension can scaffold Docker files for most popular development languages (C#, Node.js, Python, Ruby, Go, and Java) and customizes the generated Docker files accordingly. When these files are created, we also create the necessary artifacts to provide debugging support for Node.js, Python, and .NET (C#).

Docker Explorer

The Docker extension contributes a Docker Explorer view to VS Code. The Docker Explorer lets you examine and manage Docker assets: containers, images, volumes, networks, and container registries. If the Azure Account extension is installed, you can browse your Azure Container Registries as well.

The right-click menu provides access to commonly used commands for each type of asset.

Docker Explorer context menu

You can rearrange the Docker Explorer panes by dragging them up or down with a mouse and use the context menu to hide or show them.

Customize Docker Explorer

Docker commands

Many of the most common Docker commands are built right into the Command Palette:

Docker commands