Enhance st2ctl Docker detection and usage hints (#4988) #6334
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Enhance
st2ctl
Docker detection and usage hintsThis pull request adds support for detecting when
st2ctl
is being run inside a Docker container and, for VM-style commands, immediately exits with a clear error message and guidance on the proper Docker commands to use.Background
The
st2ctl
script was originally written to manage StackStorm services on a single host or VM, using tools likeps
,systemctl
, or direct process checks. In containerized deployments, each StackStorm component runs in its own Docker container, so those VM-style operations:Issue #4988 requests that
st2ctl
detect this scenario and provide helpful Docker-specific guidance instead of attempting unsupported operations.What’s Changed
Docker detection helper
Added a new function
running_in_docker()
which returns success if either:/.dockerenv
is present, or/proc/1/cgroup
Usage suggestion helper
Added
suggest_docker_usage(subcommand)
which:1
Early exit for VM-style commands
Inserted a pre-dispatch check before the main
case "$1" in … esac
block: