Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker content refresh #5866

Merged
merged 9 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/containers/bridge-to-kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Area: containers
TOCTitle: Develop with Kubernetes
ContentId: 80bd336b-0d2d-4d63-a771-8b3ea22a64d3
PageTitle: Use Bridge to Kubernetes to run and debug locally with Kubernetes
DateApproved: 12/7/2022
DateApproved: 12/21/2022
MetaDescription: Learn how to use Bridge to Kubernetes.
---

Expand Down
12 changes: 5 additions & 7 deletions docs/containers/debug-common.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ Area: containers
TOCTitle: Debug
ContentId: A1371726-5310-4923-B43B-240F36C6264E
PageTitle: Debug an app running in a Docker container
DateApproved: 7/16/2021
DateApproved: 12/21/2022
MetaDescription: Debug an app running in a Docker container, using Visual Studio Code.
---
# Debug containerized apps

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 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.

Expand All @@ -33,13 +33,13 @@ Example `launch.json` configuration for debugging a Node.js application:

```json
{
"version": "0.2.0",
"configurations": [

{
"name": "Launch Node.js in Docker",
"name": "Docker Node.js Launch",
"type": "docker",
"request": "launch",
"preLaunchTask": "Run Docker Container",
"preLaunchTask": "docker-run: debug",
"platform": "node"
}
]
Expand Down Expand Up @@ -78,8 +78,6 @@ Example `launch.json` configuration for debugging a Python application:

More information about debugging .NET applications within Docker containers can be found in [Debug .NET within Docker containers](/docs/containers/debug-netcore.md).

> The previous (Preview) .NET 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](https://github.com/microsoft/vscode-docker/wiki/Debug-NetCore-Deprecated).

Example `launch.json` configuration for debugging a .NET application:

```json
Expand Down
2 changes: 1 addition & 1 deletion docs/containers/debug-netcore.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Area: containers
ContentId: B1DF33C0-400C-413D-B60B-D1AA278F6DE3
PageTitle: Debug a .NET app running in a Docker container
DateApproved: 4/15/2021
DateApproved: 12/21/2022
MetaDescription: Debug a .NET app running in a Docker container, using Visual Studio Code.
---
# Debug .NET within a container
Expand Down
11 changes: 6 additions & 5 deletions docs/containers/debug-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Area: containers
ContentId: F0C800DD-C477-492D-9545-745F570FE042
PageTitle: Configure and troubleshoot debugging of Node.js apps running in a Docker container
DateApproved: 9/23/2020
DateApproved: 12/21/2022
MetaDescription: How to configure and troubleshoot debugging of Node.js apps running in a Docker container, using Visual Studio Code.
---

Expand Down Expand Up @@ -117,8 +117,7 @@ Also note that the `debug` logger writes logs only when enabled via the `DEBUG`

### Configuring when the application is "ready"

The extension determines the application is "ready" to receive HTTP connections when it writes a message of the form `Listening on port <number>` to the debug console, as Express.js does by default. If the application logs a different
message, then you should set the `pattern` property of the [dockerServerReadyAction](/docs/containers/debug-common.md#dockerserverreadyaction-object-properties) object of the debug launch configuration to a [JavaScript regular expression](https://developer.mozilla.org/docs/Web/JavaScript/Guide/Regular_Expressions) that matches that message. The regular expression should include a capture group that corresponds to the port on which the application is listening.
The extension determines the application is "ready" to receive HTTP connections when it writes a message of the form `Listening on port <number>` to the debug console, as Express.js does by default. If the application logs a different message, then you should set the `pattern` property of the [dockerServerReadyAction](/docs/containers/debug-common.md#dockerserverreadyaction-object-properties) object of the debug launch configuration to a [JavaScript regular expression](https://developer.mozilla.org/docs/Web/JavaScript/Guide/Regular_Expressions) that matches that message. The regular expression should include a capture group that corresponds to the port on which the application is listening.

For example, suppose the application logs the following message:

Expand Down Expand Up @@ -210,7 +209,7 @@ Dockerfiles are often arranged in such a way as to optimize either image build t
The solution is to remove that optimization from the `Dockerfile`:

```docker
FROM node:10.13-alpine
FROM node:lts-alpine
ENV NODE_ENV=production
WORKDIR /usr/src/app
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
Expand All @@ -219,5 +218,7 @@ COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
RUN npm install --production --silent
COPY . .
EXPOSE 3000
CMD npm start
RUN chown -R node /usr/src/app
USER node
CMD ["npm", "start"]
```
9 changes: 4 additions & 5 deletions docs/containers/debug-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Area: containers
ContentId: f9ffec31-9253-4f71-a4eb-79ea7b3a8f55
PageTitle: Configure and troubleshoot debugging of Python apps running in a Docker container
DateApproved: 7/26/2021
DateApproved: 12/21/2021
MetaDescription: How to configure and troubleshoot debugging of Python apps running in a Docker container, using Visual Studio Code.
---

Expand Down Expand Up @@ -104,7 +104,6 @@ Here is an example of using `dockerServerReadyAction` to launch the browser to o
- `action`: The action to take when the pattern is found. Can be `debugWithChrome` or `openExternally`.

- `pattern`: If the application logs a different message than shown above, set the `pattern` property of the [dockerServerReadyAction](/docs/containers/debug-common.md#dockerserverreadyaction-object-properties) object to a [JavaScript regular expression](https://developer.mozilla.org/docs/Web/JavaScript/Guide/Regular_Expressions) that matches that message. The regular expression should include a capture group that corresponds to the port on which the application is listening.

- `uriFormat`: By default, the Docker extension will open the main page of the browser (however that is determined by the application). If you want the browser to open a specific page like the example above, the `uriFormat` property of the [dockerServerReadyAction](/docs/containers/debug-common.md#dockerserverreadyaction-object-properties) object should be set to a format string with two string tokens to indicate the protocol and port substitution.

## How to enable hot reloading in Django or Flask apps
Expand All @@ -119,7 +118,7 @@ When you select **Docker: Add Docker Files to Workspace** for Django or Flask, w
#ADD . /app
```

1. Within the `docker-run` task in the `tasks.json` file, create a new dockerRun attribute with a `volumes` property. This will create a mapping from the current workspace folder (app code) to the `/app` folder in the container.
1. Within the `docker-run` task in the `tasks.json` file, create a new `dockerRun` attribute with a `volumes` property. This setting creates a mapping from the current workspace folder (app code) to the `/app` folder in the container.

``` json
{
Expand Down Expand Up @@ -173,7 +172,7 @@ When you select **Docker: Add Docker Files to Workspace** for Django or Flask, w
#ADD . /app
```

1. Within the `docker-run` task in the `tasks.json` file, edit the existing dockerRun attribute by adding a `FLASK_ENV` in the `env` property as well as a `volumes` property. This will create a mapping from the current workspace folder (app code) to the `/app` folder in the container.
1. Within the `docker-run` task in the `tasks.json` file, edit the existing dockerRun attribute by adding a `FLASK_ENV` in the `env` property as well as a `volumes` property. This setting creates a mapping from the current workspace folder (app code) to the `/app` folder in the container.

``` json
{
Expand Down Expand Up @@ -250,7 +249,7 @@ When you select **Docker: Add Docker Files to Workspace** for Django or Flask, w
]
```

**Tip:** As the dependency clearly states `docker-build` as its dependency, the name has to match this task. It can be changed to anything though.
**Tip:** As the dependency clearly states `docker-build` as its dependency, the name has to match this task. You can change the name, if desired.

1. The `dockerBuild` object in the JSON allows for the following parameters:

Expand Down
18 changes: 9 additions & 9 deletions docs/containers/docker-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Area: containers
TOCTitle: Docker Compose
ContentId: c63d86a0-48f8-4724-ba24-fa5ce4199632
PageTitle: Use Docker Compose to work with multiple containers
DateApproved: 7/16/2021
DateApproved: 12/21/2022
MetaDescription: Develop a multi-container app running in a Docker containers using Docker Compose and Visual Studio Code.
---
# Use Docker Compose
Expand Down Expand Up @@ -33,7 +33,7 @@ With the docker-compose files, you can now specify port mappings in the docker-c

## Add new containers to your projects

If you want to add another app or service, you can run **Add Docker Compose Files to Workspace** again, and choose to overwrite the existing docker-compose files, but you'll lose any customization in those files. If you want to preserve changes to the compose files, you can manually modify the `docker-compose.yml` file to add the new service. Typically, you can cut and paste the existing service section and change the names as appropriate for the new service.
If you want to add another app or service, you can run **Add Docker Compose Files to Workspace** again, and choose to overwrite the existing docker-compose files, but you'll lose any customization in those files. If you want to preserve changes to the compose files, you can manually modify the `docker-compose.yml` file to add the new service. Typically, you can copy the existing service section, paste it to create a new entry, and change the names as appropriate for the new service.

You can run the **Add Docker Files to Workspace** command again to generate the `Dockerfile` for a new app. While each app or service has its own Dockerfile, there's typically one `docker-compose.yml` and one `docker-compose.debug.yml` file per workspace.

Expand Down Expand Up @@ -76,7 +76,7 @@ Create an **Attach** [launch configuration](/docs/editor/debugging.md#launch-con
command: node --inspect=0.0.0.0:9229 ./bin/www
```

1. If you have multiple apps, you need to change the port for one of them, so that each app has a unique port. You can point to the right debugging port in the `launch.json`, and save the file. If you omit this, the port will be chosen automatically.
1. If you have multiple apps, you need to change the port for some of them, so that each app has a unique port. You can point to the right debugging port in the `launch.json`, and save the file. If you omit this, the port will be chosen automatically.

Here's an example that shows the Node.js launch configuration - Attach:

Expand Down Expand Up @@ -111,7 +111,7 @@ For debugging Python with Docker Compose, follow these steps:

![Screenshot of Python Remote Attach](images/compose/docker-compose-python-remote-attach.png)

1. You'll be prompted to choose the host machine (for example, localhost) and port you want to use for debugging. The default debugging port for Python is 5678. If you have multiple apps, you need to change the port for one of them, so that each app has a unique port. You can point to the right debugging port in the `launch.json`, and save the file. If you omit this, the port will be chosen automatically.
1. You're prompted to choose the host machine (for example, localhost) and port you want to use for debugging. The default debugging port for Python is 5678. If you have multiple apps, you need to change the port for one of them, so that each app has a unique port. You can point to the right debugging port in the `launch.json`, and save the file. If you omit this, the port will be chosen automatically.

```json
"configurations": [
Expand Down Expand Up @@ -167,7 +167,7 @@ For debugging Python with Docker Compose, follow these steps:

### .NET

1. On the **Debug** tab, choose the **Configuration** dropdown, choose **New Configuration** and select the `Docker Attach` configuration template **.NET Core Docker Attach (Preview)**.
1. On the **Debug** tab, choose the **Configuration** dropdown, choose **New Configuration** and select the `Docker Attach` configuration template **.NET Core Docker Attach**.
ghogen marked this conversation as resolved.
Show resolved Hide resolved
ghogen marked this conversation as resolved.
Show resolved Hide resolved

1. VS Code tries to copy `vsdbg` from the host machine to the target container using a default path. You can also provide a path to an existing instance of `vsdbg` in the **Attach** configuration.

Expand Down Expand Up @@ -226,7 +226,7 @@ Workspaces can have multiple docker-compose files to handle different environmen

### Base file and an override file

Let's assume your workspace has a base compose file (`docker-compose.yml`) and an override file for each environment (`docker-compose.dev.yml`, `docker-compose.test.yml` and `docker-compose.prod.yml`) and you always compose up with the base file and an override file. In this case, the `compose up` command can be customized as in the following example. When the `compose up` command is invoked, the `${configurationFile}` is replaced by the selected file.
Let's assume your workspace has a base compose file (`docker-compose.yml`) and an override file for each environment (`docker-compose.dev.yml`, `docker-compose.test.yml` and `docker-compose.prod.yml`) and you always run `docker compose up` with the base file and an override file. In this case, the `compose up` command can be customized as in the following example. When the `compose up` command is invoked, the `${configurationFile}` is replaced by the selected file.

```json
"docker.commands.composeUp": [
Expand All @@ -239,7 +239,7 @@ Let's assume your workspace has a base compose file (`docker-compose.yml`) and a

### Template matching

Let's assume you have different set of input files for each environment. You could define multiple templates with regular expression match, and the selected file name will be matched against this `match` property and the corresponding template will be used.
Let's assume you have a different set of input files for each environment. You could define multiple templates with regular expression match, and the selected file name will be matched against this `match` property and the corresponding template will be used.

```json
"docker.commands.composeUp": [
Expand All @@ -263,7 +263,7 @@ Let's assume you have different set of input files for each environment. You co

### Pick a template when the command is invoked

If you omit the `match` property from command templates, you will be asked which template to use each time `compose up` command is invoked. For example:
If you omit the `match` property from command templates, you're asked which template to use each time `compose up` command is invoked. For example:

```json
"docker.commands.composeUp": [
Expand All @@ -284,7 +284,7 @@ If you omit the `match` property from command templates, you will be asked which

## Custom tasks

Rather than use command customization, you can also define a task like the following to invoke a `docker-compose` command. Please refer [custom task](/docs/editor/tasks.md#custom-tasks) for more detail on this.
Rather than use command customization, you can also define a task like the following to invoke a `docker-compose` command. Please refer [custom task](/docs/editor/tasks.md#custom-tasks) for more detail on this option.

```json
{
Expand Down
4 changes: 2 additions & 2 deletions docs/containers/images/overview/container-registry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/containers/images/overview/dockerfile-intellisense.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/containers/images/quickstarts/aspnetcore-add-dotnet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/containers/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Area: containers
TOCTitle: Overview
ContentId: 4B462667-8915-4BE0-B8D0-EDE51CB2D273
PageTitle: Docker extension for Visual Studio Code
DateApproved: 11/3/2021
DateApproved: 12/13/2022
MetaDescription: Tools for developing and debugging with Docker containers, using Visual Studio Code.
---
# Docker in Visual Studio Code
Expand All @@ -25,7 +25,7 @@ To install the extension, open the Extensions view (`kb(workbench.view.extension

## Editing Docker files

You can get [IntelliSense](/docs/editor/intellisense.md) when editing your `Dockerfile` and `docker-compose.yml` files, with completions and syntax help for common commands.
You can get [IntelliSense](/docs/editor/intellisense.md) by clicking `kb(editor.action.triggerSuggest)` when editing your `Dockerfile` and `docker-compose.yml` files, with completions and syntax help for common commands.

![IntelliSense for Dockerfiles](images/overview/dockerfile-intellisense.png)

Expand Down Expand Up @@ -81,7 +81,7 @@ You can display the content and push, pull, or delete images from [Azure Contain

![Azure Container Registry content](images/overview/container-registry.png)

An image in an Azure Container Registry can be deployed to Azure App Service directly from VS Code. See [Deploy images to Azure App Service](/docs/containers/app-service.md) to get started. For more information about how to authenticate to and work with registries, see [Using container registries](/docs/containers/quickstart-container-registries.md).
An image in an Azure Container Registry can be deployed to Azure App Service directly from VS Code. See [Deploy to Azure App Service](/docs/containers/app-service.md) to get started. For more information about how to authenticate to and work with registries, see [Using container registries](/docs/containers/quickstart-container-registries.md).

## Debugging services running inside a container

Expand Down
Loading