With version 0.9.0 and later, the Docker extension provides more support for debugging applications within Docker containers, such as scaffolding
launch.json configurations for attaching a debugger to applications running within a container.
The Docker extension provides a
docker debug configuration provider that manages how VS Code will launch an application and/or attach a debugger to the application in a running Docker container. This provider is configured via entries within
launch.json, with configuration being specific to each application platform supported by the provider.
The Docker extension currently supports debugging Node.js, Python, and .NET Core applications within Docker containers.
Django Tutorials What is Django? Django is a high-level Python Web framework that encourages rapid development and clean pragmatic design. A Web framework is a set of components that provide a standard way to develop websites fast and easily. Django’s primary goal is to ease the creation of complex database-driven websites.
- Django is an opinionated framework and I've added a few extra opinions based on having Dockerized and deployed a number of Django projects. Here's a few (but not all) note worthy additions and changes. Packages and extensions: gunicorn for an app server in both development and production.
- This is a step-by-step tutorial that details how to configure Django to run on Docker with Postgres. For production environments, we'll add on Nginx and Gunicorn. We'll also take a look at how to serve Django static and media files via Nginx. Dependencies: Django v3.0.7; Docker v19.03.8; Python v3.8.3; Django on Docker.
Scaffolding or pasting a launch configuration into
launch.json is not sufficient to build and debug a Docker container. To successfully run a Docker launch configuration, you must have:
- A Dockerfile.
- A launch configuration that invokes these tasks.
We recommend using the Docker: Add Docker Files to Workspace... command to create these items, if none of these assets already exist. If you already have a functional Dockerfile, we recommend using the Docker: Initialize for Docker debugging command to scaffold a launch configuration and Docker-related tasks.
More information about debugging Node.js applications within Docker containers can be found at Debug Node.js within a container.
launch.json configuration for debugging a Node.js application:
More information about debugging Python applications within Docker containers can be found at Debug Python within a container.
launch.json configuration for debugging a Python application:
More information about debugging .NET Core applications within Docker containers can be found in Debug .NET Core within Docker containers.
The previous (Preview) .NET Core Docker debugging support (utilizing
'type': 'docker-coreclr' instead of the current preview's
'type': 'docker') is being deprecated. You can still find documentation on that support at Debug .NET Core - Deprecated.
launch.json configuration for debugging a .NET Core application:
|Name of the container used for debugging.|
|Options for launching a browser to the Docker container. Similar to serverReadyAction, but replaces container ports with host ports.|
|Whether to remove the debug container after debugging.|
|The target platform for the application. Can be |
|Options for debugging .NET Core projects in Docker.|
|Options for debugging Node.js projects in Docker.|
|Options for debugging Python projects in Docker.|
dockerServerReadyAction object properties
|The action to take when the pattern is found. Can be |
|The container name to match the host port.|
|The regex pattern to look for in Debug console output.|
|The URI format to launch.|
|The root folder from which web pages are served. Used only when |
node object properties
These properties are the same as those described in the VS Code documentation for attaching a debugger to Node.js applications. All properties passed in the
node object will be passed on to the Node.js debug adaptor, even if not specifically listed below.
|Optional. The debug port to use.|
|Optional. TCP/IP address of the debug port.|
|Optional. Enable source maps by setting this to |
|Optional. Track all subprocesses of debuggee and automatically attach to those that are launched in debug mode.|
|Optional. When restarting a session, give up after this number of milliseconds.|
|Optional. Break immediately when the program launches.|
|Optional. VS Code's root directory.||The root workspace folder.|
|Optional. Node's root directory within the Docker container.|
|Optional. Try to automatically step over code that doesn't map to source files.|
|Optional. Automatically skip files covered by these glob patterns.|
|Optional. Enable diagnostic output.|
python object properties
|The host for remote debugging.|
|The port for remote debugging.|
|Maps the project path between local machine and remote host.|
|Type of Python app.|
|Debug only user-written code.|
|Jinja template debugging (such as Flask).|
netCore object properties
Django Docker Nginx
Properties passed in the
netCore object are generally passed on to the .NET Core debug adaptor, even if not specifically listed below. The complete list of debugger properties is in the OmniSharp VS Code extension documentation.
|The .NET Core project (.csproj, .fsproj, etc.) to debug.|
Django Docker Postgres
Read on to learn more about: