Mount a Debugger
How to debug a Minimus container by mounting debug tools
Production Minimus container images do not include a shell. While we recomment most customers use the -dev
tagged Minimus images for troubleshooting, sometimes it may be necessary to debug your running container built from a Minimus Production image.
Prepare the debugger container
We can use the Minimus Busybox image to pre-configure our debugger container. We will create the container (without running it), extract its filesystem, and place it in a local directory.
Start the target container and mount the debugger image
Start the debugging session
Start the debug session, reusing the namespaces and cgroups from the target container (my-image
). This is possible because the two containers share namespaces and cgroups.
Update the system's executable search path
Before we can use the debugging tools from the mount, we’ll first need to modify the PATH
environment variable by appending (or prepending) /.debugger/bin
to it. This works because the busybox toolkit in our mounted volume is statically linked.
You can either prepend or append the debugger container. It just depends how you want the system to behave in the case of a name collision:
- Appending the debugger means the binaries from the target container will take precedence.
- Prepending the debugger means the binaries from the debugger container will take precedence.
Ready to debug!
That’s it. You are now ready to use the busybox toolkit as if it were natively in the target container.
For example, you can explore the filesystem of the target container and list the running processes and network interfaces:
The output should show you the information for your target Minimus container, as if you were running the command directly inside it.
This section is inspired by insights from Ivan Velichko’s blog.