Docker DX extension for Visual Studio Code
Go to file
Remy Suen c08c18719e
Merge pull request #116 from docker/prepare-v0.7.0-release
Prepare for the v0.7.0 release
2025-05-21 09:56:18 -04:00
.devcontainer chore: install docker-cli in devcontainer 2025-03-20 17:27:58 +03:30
.github Use the right matrix attribute for publishing 2025-04-28 08:52:50 -04:00
.vscode Enforce file formatting when a file is saved 2025-03-20 11:35:41 -04:00
build Remove print statements that were added for debugging 2025-05-21 09:16:20 -04:00
resources Describe the provided features in README.md 2025-03-19 16:26:22 -04:00
src Record if certain extensions are installed 2025-05-21 09:12:06 -04:00
test Remove public references to the feature flag configuration setting 2025-04-08 13:19:33 -04:00
.eslintrc.json Add GHA 2025-03-21 12:58:12 +00:00
.gitignore Introduce vscode-extension-tester to support UI testing 2025-04-02 13:57:15 -04:00
.prettierignore Make prettier ignore syntaxes 2025-04-02 08:34:09 +01:00
.prettierrc.yml Create a Visual Studio Code extension to support Docker file types 2025-03-18 16:08:38 -04:00
.vscodeignore Introduce vscode-extension-tester to support UI testing 2025-04-02 13:57:15 -04:00
CHANGELOG.md Prepare for the v0.7.0 release 2025-05-21 09:52:51 -04:00
CONTRIBUTING.md Rename the extension tentatively to Docker DX 2025-03-26 07:56:09 -04:00
LICENSE Create a Visual Studio Code extension to support Docker file types 2025-03-18 16:08:38 -04:00
NOTICE.html Update NOTICE.html 2025-04-02 11:27:04 +01:00
README.md Fix the prettier linting errors 2025-05-20 13:05:18 -04:00
SECURITY.md Rename the extension tentatively to Docker DX 2025-03-26 07:56:09 -04:00
TELEMETRY.md Fix the linting errors 2025-05-21 09:17:11 -04:00
package-lock.json Prepare for the v0.7.0 release 2025-05-21 09:52:51 -04:00
package.json Prepare for the v0.7.0 release 2025-05-21 09:52:51 -04:00
tsconfig.json Introduce vscode-extension-tester to support UI testing 2025-04-02 13:57:15 -04:00
webpack.config.js Create a Visual Studio Code extension to support Docker file types 2025-03-18 16:08:38 -04:00

README.md

Docker DX

The Docker DX (Developer Experience) Visual Studio Code extension enhances your Visual Studio Code experience with Docker-related development by adding rich editing features and vulnerability scanning.

Key features

  • Dockerfile linting: Get build warnings and best-practice suggestions via BuildKit and BuildX.
  • Bake file support: Includes code completion, variable navigation, and inline suggestions for generating targets based on your Dockerfile stages.
  • Compose file outline: Easily navigate complex Compose files with an outline view in the editor.
  • Image vulnerability scanning (experimental): Flags references to container images with known vulnerabilities directly within Dockerfiles.

Requirements

The extension requires Docker Engine to be running. Install Docker Desktop on your machine and make sure the docker CLI is available in your system PATH.

This extension currently supports the following operating systems and architectures:

Operating system Architectures
Windows amd64, arm64
macOS amd64, arm64
Linux amd64, arm64
Alpine amd64, arm64

If you are on an unsupported system, let us know of your interest in this extension so we can prioritize the work accordingly.

Feature overview

Editing Dockerfiles

You can get linting checks from BuildKit and BuildX when editing your Dockerfiles.

Any references to images with vulnerabilities are also flagged. Note: This is an experimental feature.

Errors are visible directly in your editor or you can look at them by opening up the Problems panel (Ctrl+Shift+M on Windows/Linux, Shift+Command+M on Mac).

Linting a Dockerfile for build warnings and the use of vulnerable images

Editing Bake files

You can get code completion when editing your docker-bake.hcl file. You are also able to hover over variables and navigate around the file by jumping to a variable's definition or jumping to the build stage within a Dockerfile.

Editing a Bake file with code completion and cross-file linking support

The extension provides inline suggestions to generate a Bake target to correspond to each build stage in your Dockerfile.

Suggesting Bake targets based on the content of the local Dockerfile

Editing Compose files

You can view an outline of your Compose file which makes it easier to navigate.

Outline of a Docker Compose file in the Outline panel and from the Command Palette

Builds

GitHub Actions builds six .vsix files - one for each platform combination(Windows, macOS, Linux x amd64/arm64).

Note: The language server binary from these builds are not signed and/or notarized. You may encounter issues when using .vsix files from this repository as your operating system may refuse to open an unsigned binary.

Development

To debug the VS Code extension, clone this repository and then run npm install. This will download a binary of the Docker Language Server to the bin folder. If you would like to test your own custom build of the language server, simply replace the file in the bin folder with your own binary.

Debugging both the extension and language server

  1. Clone the docker/docker-language-server repository
  2. Start the language server in debug mode with the --address :49201 argument.
  3. In VS Code, update the docker.lsp.debugServerPort setting to 49201. This is the default port that is used for any launch configurations saved in Git.
  4. Launch the extension in debug mode. It will connect to the language server you started in debug mode instead of trying to execute a binary in bin/.

Testing

Run npm test to launch the UI tests.

Telemetry

The Docker DX extension collects telemetry. We collect this telemetry so that we can improve the extension by understanding usage patterns and catching crashes and errors for diagnostic purposes. Note that if you have already opted out of sending telemetry in Visual Studio Code then no telemetry will be sent.

See TELEMETRY.md for details about what kind of telemetry we collect and how to configure your telemetry settings.

FAQ

I can see duplicated code completion suggestions and/or hover tooltips in Compose files.

Do you have any of the following extensions installed?

  • Red Hat's YAML extension (powered by redhat-developer/yaml-language-server)
    1. To disable duplicates from this extension, create a JSON file with {} as its content and save it somewhere. Let's say it is at /home/user/empty.json.
    2. Open the Command Palette in Visual Studio Code and open "Preferences: Open User Settings (JSON)".
    3. Create an object attribute for yaml.schemas if it does not already exist.
    4. Inside the yaml.schemas object, map your empty JSON file to Compose YAML files.
{
  "yaml.schemas": {
    // this tells Red Hat's YAML extension to consider Compose YAML
    // files as not having a schema so it will stop suggesting code
    // completion items, hover tooltips, and so on
    "/home/user/empty.json": ["compose*y*ml*", "docker-compose*y*ml*"]
  }
}