| skipped 66 lines |
67 | 67 | | <summary>How it works</summary> |
68 | 68 | | |
69 | 69 | | The technique is based on the ideas from this [blog post](https://iximiuz.com/en/posts/docker-debug-slim-containers). |
| 70 | + | |
| 71 | + | ![How: cdebug exec](assets/images/cdebug-exec.png) |
| 72 | + | |
70 | 73 | | Oversimplifying, the debugger container is started like: |
71 | 74 | | |
72 | 75 | | ```sh |
| skipped 43 lines |
116 | 119 | | |
117 | 120 | | `socat TCP-LISTEN:<REMOTE_PORT>,fork TCP-CONNECT:<REMOTE_HOST>:<REMOTE_PORT>` |
118 | 121 | | |
| 122 | + | ![How: cdebug port-forward -L (direct)](assets/images/cdebug-port-forward-local-direct.png) |
| 123 | + | |
119 | 124 | | If the _REMOTE_HOST_ doesn't belong to the target or it's the target's localhost, |
120 | 125 | | an extra sidecar container is started in the target's network namespace with another |
121 | 126 | | socat forwarding traffic from the target public interface to `REMOTE_HOST:REMOTE_PORT`. |
| 127 | + | |
| 128 | + | ![How: cdebug port-forward -L (sidecar)](assets/images/cdebug-port-forward-local-sidecar.png) |
122 | 129 | | |
123 | 130 | | **Remote port forwarding** will use similar tricks but combined with more advanced |
124 | 131 | | reverse tunneling. |
| skipped 147 lines |