Search code examples
expressdocker-composebuilddockerfilecontainers

Trouble with defining environment variables in Docker Compose file


I'm encountering an issue while defining environment variables in my Docker Compose file. Here's the relevant excerpt from my Docker Compose file:

version: '3' services: app: build: context: . dockerfile: Dockerfile ports: - '3000:3000'

When I try to build my Docker containers using docker-compose build, I get the following error message: unexpected character "," in variable name near ",\n\n# ApacheRabbitMQ\nRABBITMQ_CONN=amqp+ssl://b-d8788e14-1.mq.us-east-2.amazonaws.com:5671\n\n# AWS\nS3_BUCKET="YOURS3BUCKET"\nSECRET_KEY="YOURSECRETKEYGOESHERE"\n\n# JWT\nJWT_SECRET=""\nJWT_ISSUER=""\nJWT_SUBJECT=""\nJWT_ALGORITHM=""\nJWT_EXPIRES=""\nDATE_FORMAT=""\n\n# PAYOUT SERVICE\n# STANBIC_URL=https://stannnel.ank.com/stanbic-outward \nSTANBIC_URL=https://providus./providus\nNIP_URL=https://niay.tank.com/nip-mini\nRAIL=stanbic\nPAYOUT_SECRET_KEY=iie2eEiKgjJPVgSOfiq+wePp1fCq1A= \n# production iiebXVgSOfiq+wePp1fCq1A=\n#test R2V0GhAS3JlZGlUZXN0\n# GENERAL_LEDGER_ID=3


Solution

  • I had the same issue, had to go through *.env files, and put any thing that has a space between double quotes. This fixed the issue for me!