Skip to content

--version command line doesn't exit if executed in a container #1042

@ofalk

Description

@ofalk

Describe the problem
I'm not an expert in Go, but I observed an interesting behavior with this project, that --version command line doesn't end the execution.

Running the exporter

On the command line (freshly built with make):

# ./redis_exporter --version && echo $?
INFO[0000] Redis Metrics Exporter <<< filled in by build >>>    build date: <<< filled in by build >>>    sha1: <<< filled in by build >>>    Go: go1.25.0    GOOS: darwin    GOARCH: arm64
0

Via podman (freshly built with podman build .):

# timeout 1 podman run d2a125b3f2a8 ./redis_exporter --version; echo $?
time="2025-09-18T08:04:53Z" level=info msg="Redis Metrics Exporter [no-tag]    build date:     sha1: [no-sha]    Go: go1.25.1    GOOS: linux    GOARCH: arm64"
time="2025-09-18T08:04:53Z" level=info msg="Setting log level to \"info\""
time="2025-09-18T08:04:53Z" level=info msg="Providing metrics at :9121/metrics"
time="2025-09-18T08:04:54Z" level=info msg="Received terminated signal, exiting"
time="2025-09-18T08:04:54Z" level=info msg="Server shut down gracefully"
124

As you can see, in the containerized environment, it continues to execute after showing the version information. Timeout has to kill it.

Expected behavior

Command line option --version should also lead to an exit of the process.

Additional context
Tried that with podman 5.6.0, 5.5.1 and container 0.4.1 (Apple native).

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions