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) You can run:
source image.envbefore runningdocker-compose upso that those environment variables are set in your system environment -
(2) You can rename
image.envto.envand then docker-compose will read them as environment variables to be used for substitution in yourdocker-compose.yamlfile.
I believe fo from your example that you want the second option.