Variables resolved from env_file but not taking effect in docker-compose.yaml

The env_file parameter is for defining environment variables inside the running container. It will not be used for variable substitution in your docker-compose.yaml file (as you have seen).

You have two options:

  1. (1) You can run: source image.env before running docker-compose up so that those environment variables are set in your system environment

  2. (2) You can rename image.env to .env and then docker-compose will read them as environment variables to be used for substitution in your docker-compose.yaml file.

I believe fo from your example that you want the second option.