Docker compose env variables not working?

installing rocket-chat using docker-compose

OS version: Ubuntu 20.04
App version: docker.io 20.10.12
Steps to reproduce:

  1. fresh install ubuntu 20.04
  2. install docker.io docker-compose, config docker run without sudo
  3. curl compose.yml and .env from https://github.com/RocketChat/Docker.Official.Image
  4. rename compose.yml to docker-compose.yml , env.example to .env
  5. docker-compose up -d

got error:

ERROR: Invalid interpolation format for "rocketchat" option in service "services": "registry.rocket.chat/rocketchat/rocket.chat:${RELEASE:-latest"

then I change the
"registry.rocket.chat/rocketchat/rocket.chat:${RELEASE:-latest"
in the docker-compose.yml to
registry.rocket.chat/rocketchat/rocket.chat:5.4.3

the the error come to

ERROR: Invalid interpolation format for "rocketchat" option in service "services": "${MONGO_URL:-mongodb://${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}/${MONGODB_DATABASE:-rocketchat}?replicaSet=${MONGODB_REPLICA_SET_NAME:-rs0}}"

So, I assume that the docker-compose env variable doesn’t work on my machine.
How could I fix it?

You forgot to share the version of your Docker Compose which would be probably the only relevant information :slight_smile:

The example is for Docker Compose v2, and since you renamed compose.yml to docker-compose.yml and used docker-ompose up -d instead of docker compose up -d, I guess you are using an older version.

1 Like