> For the complete documentation index, see [llms.txt](https://burkeholland.gitbook.io/vs-code-can-do-that/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://burkeholland.gitbook.io/vs-code-can-do-that/exercise-5-docker/debugging-docker-containers.md).

# Debugging Docker containers

Sometimes, you have code running in a container that is not working. In that case, it's useful to be able to debug the application as it's running inside of the container. VS Code provides the correct Docker configuration to do this.

{% tabs %}
{% tab title="Exercise" %}

* Build the container with the "debug.docker-compose.yml" file
* Add a launch configuration for Docker
* Attach the debugger to the running container
* Set a breakpoint in the "routes/index.js" file
* Visit the app in the browser, change the color and click the button
* See the debugger break at the breakpoint
  {% endtab %}

{% tab title="Answer" %}

* Open the Command Palette(**Cmd/Ctrl + Shift + P**)
* Select "Docker: Compose Up"

![](/files/-Lm5ulYpo-1Y43zu9zrV)

* Select the "start" project from the prompt

![](/files/-Lm5usu5xrRJP2sEsthO)

* Select the "debug.docker-compose.yml" file from the prompt

![](/files/-Lm5v-vqcFr5JkqitHSB)

* Open the Debug Explorer view (**Cmd/Ctrl + Shift + D**)
* Open the dropdown list at the top and select "Add Config (start)"

![](/files/-Lm5vIZpkTWRM4e6acsw)

* Select "Docker: Node.js" from the prompt

![](/files/-Lm5vhcv7Pybh8_mnkMy)

* Take the default Docker Remote Route prompt

![](/files/-Lm5vo-d6MgJdc55xpSK)

* VS Code will add a ".vscode" folder to the "start" project. In that folder will be a file called "launch.config"

![](/files/-Lm5wSG10_6Eq6_vmaJS)

* Open the Debug Explorer View
* Make sure "Docker: Attach to Node" is selected and press the green arrow

![](/files/-Lm5wgAvI7K2qWLVxduw)

* VS Code attaches the debugger
* Open the "routes/index.js" file in the "start" project
* Add a breakpoint to line 12

![](/files/-Lm5wtCUSp85yvd-5Jck)

* View the app in the browser running on port 3000

![](/files/-Lm5x0GZUFr3ncREqkSu)

* Change the color and click the "Go" button
* VS Code will break on line 12 of the "index.js" file inside of the Docker container

![](/files/-Lm5xFikCj79nEWmBnRl)
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://burkeholland.gitbook.io/vs-code-can-do-that/exercise-5-docker/debugging-docker-containers.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
