Using Circleci context in a service container

some-job:
  docker:
    - image: python
    - image: some-proxy
      command: ["-password:$SOME_VAR_FROM_CONTEXT"]

In this example, SOME_VAR_FROM_CONTEXT is a variable I have defined in my context.

It appears that SOME_VAR_FROM_CONTEXT is not available in my service container. Only my primary container. How would I pass this in?

I believe you need to enable contexts in your workflow, see point (4) here:

https://circleci.com/docs/2.0/contexts/

THanks @halfer, I’m not sure I understand

In my script of the primary container I do have access to the context:

some-job:
  docker:
    - image: python
    - image: some-proxy
      command: ["-password:$SOME_VAR_FROM_CONTEXT"] # << does not work
  steps:
    - run: echo "$SOME_VAR_FROM_CONTEXT" # << works

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.