Can’t decrypt _val for key=…, invalid token or value

I’m trying to use docker for airflow. My directories are ordered like so:

airflow/
| 
|--dags/
|  |--test_dag.py
|
|--docker/
|  |--config/
|  |  |--airflow.cfg
|  |
|  |--docker-compose.yml
|  |--Dockerfile
|
|--requirements.txt
|--variables.json

I have the following in my airflow.cfg file:

...
# Secret key to save connection passwords in the db
fernet_key = $FERNET_KEY
...

I set the FERNET_KEY environment variable in my docker-compose file:

version: '2.1'
services:
    postgres:
        image: postgres:9.6
        environment:
            - POSTGRES_USER=airflow
            - POSTGRES_PASSWORD=airflow
            - POSTGRES_DB=airflow

    webserver:
        image: docker-airflow
        restart: always
        depends_on:
            - postgres
        environment:
            - LOAD_EX=n
            - EXECUTOR=Local
            - FERNET_KEY=<FERNET_KEY>

        volumes:
            - $AIRFLOW_HOME/dags:/usr/local/airflow/dags
            - $AIRFLOW_HOME/variables.json:/variables.json
        ports:
            - "8080:8080"
        command: webserver
        healthcheck:
            test: ["CMD-SHELL", "[ -f /usr/local/airflow/airflow-webserver.pid ]"]
            interval: 30s
            timeout: 30s
            retries: 3

When I attempt docker-compose up I am met with an error in my test_dag.py: Can't decrypt _val for key=test_env_variable, invalid token or value

Am I missing something? Do I need to specify my FERNET_KEY in an additional location? Any help is greatly appreciated.

Source: StackOverflow