我有一个缓存文件夹,路径存储在一个环境变量中: $LOCAL_CACHE (export LOCAL_CACHE=/home/me/path/to/any/cache/folder)
现在,我想在.env文件中附加一些其他文件夹:
我的.env文件:
LOCAL_COMPOSER_DIR=${LOCAL_CACHE}/composer LOCAL_NPM_DIR=${LOCAL_CACHE}/npm LOCAL_BOWER_DIR=${LOCAL_CACHE}/bower
我的docker_compose.yml看起来像这样:
version: '2' services: composer: env_file: .env image: composer/composer volumes: - ./src:${APP_ROOT} - ${LOCAL_COMPOSER_DIR}:/composer working_dir: ${APP_ROOT}
当我启动服务时,docker-compose run composer instal. ...
它停止并显示以下错误:ERROR: Named volume "$LOCAL_CACHE"/composer":/composer:rw" is used in service "composer" but no declaration was found in the volumes section.
我不确定,但是.env文件似乎不支持使用变量。