Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
darKoram opened this issue Jan 14, 2018 · 18 comments
Closed

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

darKoram opened this issue Jan 14, 2018 · 18 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@darKoram
Copy link

darKoram commented Jan 14, 2018

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.

@kbroughton
Copy link

I have a workaround for this now:
// this gets the .env files stamped into the -out.yml file
docker-compose config -f docker-compose.yml > docker-compose-out.yml
kompose convert -f docker-compose-out.yml

perhaps kompose should be loading based off of docker-compose config output?

@cpcundill
Copy link

Same problem for me. The workaround helps @kbroughton but the docker-compose config output changes the version from '2' in the original to '2.0' which isn't supported by kompose

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 4, 2018
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jul 4, 2018
@vikasgubbi
Copy link

If the environment variable file need to be placed in the application config location , what needs to be done

@vikasgubbi
Copy link

Correction

If the environment variable file need to be placed in the custom application config location , what needs to be done

@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@TonyApuzzo
Copy link

/reopen

@k8s-ci-robot
Copy link
Contributor

@TonyApuzzo: You can't reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@chiqui3d
Copy link

I just tried it for the first time and I got this error: I guess it's because of the .env file or env variable?

error decoding 'Volumes[0]': invalid spec: ./app:: empty section between colons

volumes:
      - ./app:${APP_SYMFONY_DIRECTORY}

@ayoubbensakhria
Copy link

ayoubbensakhria commented Sep 3, 2020

I had the same issue, here is what I did:
docker-compose version: '3.7' --> doesn't work
docker-compose version: '2' --> it works

@hangyan hangyan reopened this Sep 5, 2020
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@hangyan hangyan reopened this Aug 11, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closing this issue.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@GalaxyTimeMachine
Copy link

/reopen

@k8s-ci-robot
Copy link
Contributor

@R-Farrell: You can't reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@Nikspanchal
Copy link

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.

plzz give me windows path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests