Docker compose ¿caching? env variables

I’m experiencing very strange behaviour with docker-compose. I have a repository configured to work with docker swarm for production and docker-compose for development. Swarm is working OK in production, but docker-compose is having strange behaviour.

Specifically, I’m defining build arguments with parameter substitution, like this

build:
  context: .
  args:
    - APP_DIRECTORY=${APP_DIRECTORY:-/srv/app}
    - APP_ENV=${APP_ENV:-dev}

When APP_ENV is not defined or is empty, it should take the value dev. This was working fine, but now it’s taking the value prod when the variable is not defined. I rebooted, cleared all envrionment variables, even removed docker-compose and installed it again, and APP_ENV is still being assinged prod. Is there some sort of caching done by compose that I’m not being aware of?

Another strange behaviuor, is that docker-compose is passing proxy-related envionment variables to the container. Those variables are not specified on the compose file, and they are not even present on the host. Again, is there some soer of caching taking place? And why is docker-compose passing env variables that I didn’t ask for to the container?

Any help, guidance or suggestion is welcomed.