env var in a docker container cannot be echoed

I’ve built a docker image containing a number of environment variables, including one called SPARK_HOME. Here is the line from the Dockerfile that declares that env var:

ENV SPARK_HOME="/opt/spark"

When I issue docker run I can see that the env var exists but any reference to it doesn’t return anything, as demonstrated in a simple echo:

$ docker run --rm myimage /bin/bash -c "env | grep SPARK_HOME ; echo SPARK_HOME=$SPARK_HOME"
SPARK_HOME=/opt/spark
SPARK_HOME=
$

Am I missing something obvious here? Why can I not refer to the value of an existing env var?

Source: StackOverflow