I am trying to write a default-parameters
CMD that references a container environment variable. (The container specifies an entrypoint, so I cannot use the
exec form, and I am using AWS Fargate, so I cannot use the
I see from the documentation: 
Unlike the shell form, the exec form does not invoke a command shell. This means that normal shell processing does not happen. For example,
CMD [ "echo", "$HOME" ]will not do variable substitution on
$HOME. If you want shell processing then either use the shell form or execute a shell directly, for example:
CMD [ "sh", "-c", "echo $HOME" ]. When using the exec form and executing a shell directly, as in the case for the shell form, it is the shell that is doing the environment variable expansion, not docker.
I want to pass the container environment variable into entrypoint option
-d, which, following the documentation, leads me to something like this:
["-d", "sh", "-c", "echo $FOOBAR"]. But, of course, this doesn’t work because it doesn’t know to evaluate the
sh command, but instead treats
sh as a string that I am assigning to option
Thank you, in advance, for any suggestions.