Using env vars in a docker cmd?
I have this line in my Dockerfile:
CMD [“rqworker”, “–host=$REDIS_MASTER_SERVICE_HOST”]
REDIS_MASTER_SERVICE_HOST is set by Kubernetes, and works fine when accessed within my python app. I need to point rqworker to it, but it doesn’t seem to be expanded:
redis.exceptions.ConnectionError: Error -2 connecting to $REDIS_MASTER_SERVICE_HOST:6379. Name or service not known.
How can I get docker to expand it into the actual value?
One Solution collect form web for “Using env vars in a docker cmd?”
Variable expansion is supported in kubernetes with the $(VAR) syntax. Please see this doc: