Could you try enabling it with the context key, in case that helps? See the YAML example in the link I gave.
It is also possible, however, that you have found a place where environment variables do not work - the command section of a secondary image is run on a remote Docker server, so might be treated differently.
The desire is to use the docker executor with N containers and build contexts, with the build context ENVs available to all containers; not just the ‘primary’ container in which all steps invoke.
In this above example, only values explicitly set in the environment key of the docker executor are being set, with those N service containers having no access to the envs in the build context nor the project contexts.
Is there any way to get the build contexts (or any envs from any level of circle) available in a given service container for the docker executor OTHER then explicitly adding them line-by-line into the ‘environment:’ key of the executor section of EACH service container?