I have a .env file like this:
PROJECT_DIR=./test_dir
SUB_DIR=$(PROJECT_DIR)/sub_dir
And docker-compose.yml file like this:
version: '3.5'
services:
service_nginx:
image: nginx
volumes:
- ${SUB_DIR}:/var/www/html
But I can't use $SUB_DIR in docker-compose.yml file for volume, I got error like this:
ERROR: Named volume "$(PROJECT_DIR)/sub_dir:/var/www/html:rw" is used in service "service_nginx" but no declaration was found in the volumes section.