Skip to content

Commit

Permalink
Add debugging section
Browse files Browse the repository at this point in the history
  • Loading branch information
RetGal committed Sep 4, 2024
1 parent f03a6ca commit d6707c3
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions content/en/docs/06/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: "6. Container interaction and debugging"
weight: 6
sectionnumber: 6
---

## Container interaction

Sometimes things don't go as smoothly as expected.

For such rare cases, Dagger gives us the possibility to start an interactive session to inspect a specific container:

```bash
dagger call backend --context=. terminal
```

This attaches us to `sh` shell inside the container returned by the `bakend` function.
To exit press `ctrl-D` repeatedly.

If you prefer another command, you can pass the optional `cmd` argument:

```bash
dagger call backend --context=. terminal --cmd=printenv
```

In this case it executes the command and terminates afterward.


### Task {{% param sectionnumber %}}.1: Start a live terminal session

Connect to the `frontend` container with a live terminal session using `bash` and list the installed debian packages.

{{% details title="show solution" mode-switcher="normalexpertmode" %}}
```bash
dagger call frontend --context=frontend terminal --cmd=bash
# dpkg -l
```
{{% /details %}}


## Debugging

In other cases, it would be helpful if we just could get a bit more detailed output.

For this purpose, every Dagger command can be invoked with the `debug` flag:

```bash
dagger call --debug backend --context=.
```




0 comments on commit d6707c3

Please sign in to comment.