[Python] Docker Compose Enviroment varibles cannot be read by application

Discussão em 'Python' iniciado por Stack, Maio 10, 2025.

  1. Stack

    Stack Membro Participativo

    I have a docker compose image for Apache/Spark and am trying to send Enviroment Varibles for AWS connection they are being saved in a common config block as per below.

    x-spark-common: &spark-common
    image: bitnami/spark:3.5.4
    environment:
    - AWS_REGION=us-east-1
    - AWS_ACCESS_KEY_ID=admin
    - AWS_SECRET_ACCESS_KEY=password
    volumes:



    When I start the container and connect to it using Bash and run 'env' I do see the varibles being assigned correctly

    AWS_REGION=us-east-1
    AWS_ACCESS_KEY_ID=admin
    AWS_SECRET_ACCESS_KEY=password


    however when I attempt to read the enviroment using os.environ it returns None for everything.

    I have tried os.getenv os.environ but both return None

    Continue reading...

Compartilhe esta Página