Skip to content
Docs

Shell Debugging

For debugging, it can be useful to enter a shell within a container. Since bulker provides shimlinks that dispatch to containers via argv[0], it’s not immediately obvious how to get into a container interactively.

Use underscore commands for interactive shells

Section titled “Use underscore commands for interactive shells”

For every command in a crate, bulker also creates an underscore variant: _COMMAND. For example, the demo crate with cowsay and fortune also provides _cowsay and _fortune.

Running an underscore command drops you into a shell inside the container that would be used to run that command, without actually running the command. This lets you debug the container interactively in the exact same environment bulker uses.

bulker activate demo
_cowsay # opens a shell in the cowsay container

To see the exact docker run or apptainer exec command that a shimlink would execute:

# Using the -p flag
bulker exec -p demo -- samtools --version
# Or set the environment variable
export BULKER_PRINT_COMMAND=1
samtools --version # prints the command instead of running it

This is useful for debugging volume mounts, user mapping, and other container settings.