Debugging containers that have no shell
18 days ago
- #docker
- #debugging
- #containers
- Docker Debug is a CLI command that allows users to get a shell into any container or image, even those without a shell.
- It helps maintain best practices by keeping images small and secure while providing debugging capabilities.
- Docker Debug comes with a toolbox containing standard Linux tools like vim, nano, htop, and curl, which can be customized using the `install` command.
- It supports multiple shells (bash, fish, zsh) and auto-detects the user's shell by default.
- Changes made in the debug shell do not affect the actual image or container, except for running or paused containers where filesystem changes are visible.
- Examples include debugging slim containers like `hello-world`, modifying files in running containers, and using the `entrypoint` tool to understand container startup commands.
- The `--command` option allows running commands directly without an interactive session, useful for scripting.
- Remote debugging is possible using the `--host` option to connect to remote Docker instances.