Skip to content

extended env_file capability to in-docker-compose.yml substitutions #909

Closed
@darKoram

Description

in #799 the tests show the ability to over-ride an 'environment' var with one from a '.env' file which is useful if the container runtime depends on the var. But another use case for docker-compose .env file is to allow ${var} substitutions in other docker-compose arguments. A common example would be

services:
  app:
    image: myapp
    volumes: ${local_path_to_data}:/data
    env_file: 
      - "./.env"

and
.env
local_path_to_data=/home/me/data # for a linux user
# or
local_path_to_data=/Users/me/data # for a mac user

In my testing, this sort of substitution is not yet supported and gives an error
* error decoding 'Volumes[0]': invalid spec: :/data empty section between colons

I would expect the default behavior to be to create a persistent volume named for the rhs of Volumes populated with the data at local_path_to_data specified in the .env file.

Metadata

Assignees

No one assigned

    Labels

    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions