Passing environment variables to Docker containers

Hi,

We need to pass an environment variable to a Docker container where the value of the variable contains a space (the variable represents arguments that the container will use internally, and we need to pass two such arguments).

Notionally:

/e MY_ENVNAME=--internalOption1 --internalOption2

Included as written above, this will fail with:

Error: Unknown option --internalOption2

This is a reasonable failure, and it’s what a normal command line invocation would do: the --internalOption2 is interpreted as a command to “docker run”.

However, on a normal command line, passing

/e MY_ENVNAME="--internalOption1 --internalOption2"

Fixes the problem.

On a Peplink BR2 PRO running 8.6, this gives the, very similar, error (note the trailing double-quote)

Error: Unknown option --internalOption2"

i.e. something appears to have split the arguments up using space delimiters without regard for quoting.

We have not been able to find any combination of quotation marks (single or double) or backslashes, etc, that fixes this.

Is there a work around for this problem?

Thanks.