Usage of Environment Variables in Container Command (CMD)

READ BEFORE POST

INFORMATION

Relevant information to this issue:

ISSUE

CMD Arguments in a Job Configuration does not recognize environment variables.

I have this in my Job’s CMD Arguments: [“./execute.sh”,“$DOMAIN”,“$JOB_NAME”]

When the jobs runs it reads $DOMAIN and $JOB_NAME as string literals. I also tried the curly braces format (i.e., ${DOMAIN}) but env vars are also read as literals.

How can I use variables in my CMD Arguments?

Hi @aedcparnie , can you please provide your Dockerfile content just to see if you declared your env vars?

Hi @rophilogene,

We’re deploying the service using a docker image. My understanding is that the Qovery variables are injected during runtime. I’ve verified this in other services deployed via container image by checking on the env vars inside the container (env vars that were not declared in the dockerfile used to build the image).

Let me know if I understood it correctly.

Also, we implemented it this way since this works in the previous platform that we’re using. If it’s not possible in Qovery, we’ll just hard code the command args.

Hello @aedcparnie,

Today we don’t support to inject environment variables through entrypoint or arguments, so hardcoding them is one alternative.

Another workaround would be to provide your own dockerfile with an entrypoint script to use the needed variables:

#!/bin/sh

./execute.sh $DOMAIN $JOB_NAME

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.