I don't believe the dollar-curly brace syntax works in the docker compose yaml file, but the way you have your .env file should suffice. And it looks like the variables you have defined in your environment block are overwriting what you have in the .env unless I am missing something