Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export CLI args as ENV variables in Docker container #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mfontesm
Copy link

Hello,
I've noticed that executable flags does not seem to work properly in the container deployment. Running the image with the following steps described in the documentation works perfectly:

docker run --name pgpool2_exporter --net=host --rm  
-e POSTGRES_USERNAME=MASKED
-e POSTGRES_PASSWORD=MASKED
-e PGPOOL_SERVICE=MASKED
-e PGPOOL_SERVICE_PORT=MASKED 
pgpool/pgpool2_exporter:latest 

Still, when running the same command with passing args, it fails. I get the following error:

docker run --name pgpool2_exporter --net=host --rm 
-e POSTGRES_USERNAME=MASKED
-e POSTGRES_PASSWORD=MASKED
-e PGPOOL_SERVICE=MASKED
-e PGPOOL_SERVICE_PORT=MASKED 
pgpool/pgpool2_exporter:latest --web.telemetry-path=/pgpool/metrics

docker: Error response from daemon: failed to create shim: OCI runtime create failed: runc create failed: unable to start container process: exec: "--web.telemetry-path": executable file not found in $PATH: unknown.

This applies to any flag that we try to startup the container. My understanding is that in the Dockerfile, the ENV variables are exported and passed to the CMD. With this approach I believe that we are unable to use the ENV variables and CLI flags from the binary as well. Please advise if I'm doing something wrong :).

In some Kubernetes deployments, it is useful to change the default metrics path/exposed ports. Not having the possibility to set these CLI args is problematic in some deployments.

I've made a change in this fork so that you can have a look. This approach works in my deployment and ensures no breaking changes by following the same logic.

Is there any other recommended way to use the CLI flags and the ENV variables with the current image? If not, do you think this could be updated in the docker image?

Thank you in advance.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant