I have a folder with a cache, and the path is stored in an environment variable: $LOCAL_CACHE (export LOCAL_CACHE=/home/me/path/to/any/cache/folder)
Now I want to add some additional folders to the .env file:
My .env file is:
LOCAL_COMPOSER_DIR=${LOCAL_CACHE}/composer
LOCAL_NPM_DIR=${LOCAL_CACHE}/npm
LOCAL_BOWER_DIR=${LOCAL_CACHE}/bower
My docker_compose.yml looks like this:
version: '2'
services:
composer:
env_file: .env
image: composer/composer
volumes:
- ./src:${APP_ROOT}
- ${LOCAL_COMPOSER_DIR}:/composer
working_dir: ${APP_ROOT}
When I start the service using docker-compose run composer instal. ..., it stops with the following error:ERROR: Named volume "$LOCAL_CACHE"/composer":/composer:rw" is used in service "composer" but no declaration was found in the volumes section.
I'm not sure, but the .env file does not seem to support the use of variables.
source
share