Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

support .env files #635

Closed
ndeloof opened this issue Sep 22, 2020 · 2 comments
Closed

support .env files #635

ndeloof opened this issue Sep 22, 2020 · 2 comments
Labels
cli cli

Comments

@ndeloof
Copy link
Collaborator

ndeloof commented Sep 22, 2020

initially reported as https://github.com/docker/ecs-plugin/issues/266

docker-compose do support .env files for variable interpolation, compose-cli should replicate this behaviour
see https://github.com/compose-spec/compose-go/blob/31db906dcfbdf0d87a21e69ffaadff485af140c8/cli/options.go#L103

@ndeloof ndeloof added the cli cli label Sep 22, 2020
@mattyweb
Copy link

seconded. the practical implication here is that we need to have separate compose files for each environment. our preference has been to share the compose file and tailor a .env file for staging, CI, production, etc.

it's not clear from the docs that this doesn't work or what the alternatives are; e.g. can environment variables be set from the shell?

@kaka-ruto
Copy link

I am using a .env file and get the following error on running docker compose up

service web doesn't define a Docker image to run: incompatible attribute

This is what I have

# .env
IMAGE_REPOSITORY='12345.region.amazonaws.com/repo-name'
# docker-compose.yml
version: "3.9"

services:
  web:
    image: "${IMAGE_REPOSITORY}"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cli cli
Projects
None yet
Development

No branches or pull requests

3 participants